You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/12/12 00:37:53 UTC

[1/3] git commit: [flex-asjs] [refs/heads/core_js_to_as] - fixes to get CordovaCameraExample to compile

Repository: flex-asjs
Updated Branches:
  refs/heads/core_js_to_as 3cfd3659b -> 8a3755f29


fixes to get CordovaCameraExample to compile


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/9a4afd6d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/9a4afd6d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/9a4afd6d

Branch: refs/heads/core_js_to_as
Commit: 9a4afd6d8ba748e65b23dc896e641c47b33c8ddb
Parents: 3cfd365
Author: Alex Harui <ah...@apache.org>
Authored: Fri Dec 11 14:33:37 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Dec 11 14:33:37 2015 -0800

----------------------------------------------------------------------
 .../Mobile/as/src/org/apache/cordova/Weinre.as  | 24 ++++-
 .../as/src/org/apache/cordova/camera/Camera.as  | 92 ++++++++++++--------
 .../projects/Mobile/compile-asjs-config.xml     |  6 +-
 frameworks/projects/Mobile/compile-config.xml   |  5 ++
 4 files changed, 86 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9a4afd6d/frameworks/projects/Mobile/as/src/org/apache/cordova/Weinre.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/as/src/org/apache/cordova/Weinre.as b/frameworks/projects/Mobile/as/src/org/apache/cordova/Weinre.as
index b405a2e..2e4b579 100644
--- a/frameworks/projects/Mobile/as/src/org/apache/cordova/Weinre.as
+++ b/frameworks/projects/Mobile/as/src/org/apache/cordova/Weinre.as
@@ -18,8 +18,11 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.cordova
 {
-	import flash.net.URLRequest;
-	import flash.net.navigateToURL;
+    COMPILE::AS3
+    {
+        import flash.net.URLRequest;
+        import flash.net.navigateToURL;            
+    }
 	
 	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IStrand;
@@ -61,10 +64,25 @@ package org.apache.cordova
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
+         *  @flexjsignorecoercion HTMLScriptElement
+         *  @flexjsignorecoercion HTMLHeadElement
 		 */
 		public function set guid(value:String):void
 		{
-			navigateToURL(new URLRequest("http://debug.phonegap.com/client/#" + value), "_blank");
+            COMPILE::AS3
+            {
+                navigateToURL(new URLRequest("http://debug.phonegap.com/client/#" + value), "_blank");                    
+            }
+            COMPILE::JS
+            {
+                var scriptNode:HTMLScriptElement = document.createElement('SCRIPT') as HTMLScriptElement;
+                scriptNode.type = 'text/javascript';
+                scriptNode.src = 'http://debug.phonegap.com/target/target-script-min.js#' + value;
+                
+                var headNode:HTMLHeadElement = document.getElementsByTagName('HEAD') as HTMLHeadElement;
+                if (headNode[0] != null)
+                    headNode[0].appendChild(scriptNode);
+            }
 		}
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9a4afd6d/frameworks/projects/Mobile/as/src/org/apache/cordova/camera/Camera.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/as/src/org/apache/cordova/camera/Camera.as b/frameworks/projects/Mobile/as/src/org/apache/cordova/camera/Camera.as
index 3984b44..faea7c0 100644
--- a/frameworks/projects/Mobile/as/src/org/apache/cordova/camera/Camera.as
+++ b/frameworks/projects/Mobile/as/src/org/apache/cordova/camera/Camera.as
@@ -18,24 +18,27 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.cordova.camera
 {
-	import flash.display.BitmapData;
-	import flash.display.DisplayObject;
-	import flash.display.DisplayObjectContainer;
-	import flash.display.Sprite;
-	import flash.events.ActivityEvent;
-	import flash.events.KeyboardEvent;
-	import flash.events.MouseEvent;
-	import flash.filesystem.File;
-	import flash.filesystem.FileMode;
-	import flash.filesystem.FileStream;
-	import flash.geom.Rectangle;
-	import flash.media.Camera;
-	import flash.media.Video;
-	import flash.ui.Keyboard;
-	import flash.utils.ByteArray;
-	
-	import org.apache.flex.utils.PNGEncoder;
-
+    COMPILE::AS3
+    {
+        import flash.display.BitmapData;
+        import flash.display.DisplayObject;
+        import flash.display.DisplayObjectContainer;
+        import flash.display.Sprite;
+        import flash.events.ActivityEvent;
+        import flash.events.KeyboardEvent;
+        import flash.events.MouseEvent;
+        import flash.filesystem.File;
+        import flash.filesystem.FileMode;
+        import flash.filesystem.FileStream;
+        import flash.geom.Rectangle;
+        import flash.media.Camera;
+        import flash.media.Video;
+        import flash.ui.Keyboard;
+        import flash.utils.ByteArray;
+        
+        import org.apache.flex.utils.PNGEncoder;
+    }
+    
 	[Mixin]
 	public class Camera
 	{
@@ -67,8 +70,10 @@ package org.apache.cordova.camera
 			FRONT : 1      // Use the front-facing camera
 		};
 
+        COMPILE::AS3
 		private static var root:DisplayObjectContainer;
 		
+        COMPILE::AS3
 		public static function init(r:DisplayObjectContainer):void
 		{
 			root = r;		
@@ -91,35 +96,47 @@ package org.apache.cordova.camera
 		
 		private var cameraSuccess:Function;
 		private var cameraError:Function;
+        COMPILE::AS3
 		private var ui:Sprite;
+        COMPILE::AS3
 		private var camera:flash.media.Camera;
 		
 		public function getPicture( cameraSuccess:Function, cameraError:Function, cameraOptions:Object ) : void
 		{
-			this.cameraSuccess = cameraSuccess;
-			this.cameraError = cameraError;
-			
-			camera = flash.media.Camera.getCamera();
-			
-			if (camera != null) {
-				ui = new Sprite();
-				var video:Video = new Video(camera.width * 2, camera.height * 2);
-				video.attachCamera(camera);
-				ui.addChild(video);
-				root.addChild(ui);
-				ui.addEventListener(MouseEvent.CLICK, mouseClickHandler);
-				ui.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
-			} else {
-				trace("You need a camera.");
-			}
+            COMPILE::AS3
+            {
+                this.cameraSuccess = cameraSuccess;
+                this.cameraError = cameraError;
+                
+                camera = flash.media.Camera.getCamera();
+                
+                if (camera != null) {
+                    ui = new Sprite();
+                    var video:Video = new Video(camera.width * 2, camera.height * 2);
+                    video.attachCamera(camera);
+                    ui.addChild(video);
+                    root.addChild(ui);
+                    ui.addEventListener(MouseEvent.CLICK, mouseClickHandler);
+                    ui.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
+                } else {
+                    trace("You need a camera.");
+                }                    
+            }
+            COMPILE::JS
+            {
+                // TODO: (aharui) Cordova externs
+                navigator["camera"].getPicture(cameraSuccess, cameraError, cameraOptions);
+            }
 		}
 		
+        COMPILE::AS3
 		private function mouseClickHandler(event:MouseEvent):void
 		{
 			savePicture();
 			root.removeChild(ui);
 		}
 		
+        COMPILE::AS3
 		private function keyDownHandler(event:KeyboardEvent):void
 		{
 			if (event.keyCode == Keyboard.ESCAPE)
@@ -131,6 +148,7 @@ package org.apache.cordova.camera
 			}
 		}
 
+        COMPILE::AS3
 		private function savePicture():void
 		{
 			var f:File = File.createTempFile();
@@ -151,7 +169,11 @@ package org.apache.cordova.camera
 		
 		public function cleanup( cameraSuccess:Function, cameraError:Function ) : void
 		{
-			// no cleanup required in Flash
+            // no cleanup required in Flash
+            COMPILE::JS
+            {
+                navigator["camera"].cleanup();                
+            }
 		}
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9a4afd6d/frameworks/projects/Mobile/compile-asjs-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/compile-asjs-config.xml b/frameworks/projects/Mobile/compile-asjs-config.xml
index face373..ba49185 100644
--- a/frameworks/projects/Mobile/compile-asjs-config.xml
+++ b/frameworks/projects/Mobile/compile-asjs-config.xml
@@ -55,10 +55,10 @@
                 <uri>library://ns.apache.org/flexjs/basic</uri>
                 <manifest>basic-manifest.xml</manifest>
             </namespace>
-            <!--<namespace>
+            <namespace>
                 <uri>library://ns.apache.org/flexjs/cordova</uri>
                 <manifest>cordova-manifest.xml</manifest>
-            </namespace>-->
+            </namespace>
         </namespaces>
         
         <source-path>
@@ -76,11 +76,11 @@
     
     <include-classes>
         <class>MobileClasses</class>
-        <!-- <class>CordovaClasses</class> -->
     </include-classes>
     
     <include-namespaces>
         <uri>library://ns.apache.org/flexjs/basic</uri>
+        <uri>library://ns.apache.org/flexjs/cordova</uri>
     </include-namespaces>
         
     <target-player>${playerglobal.version}</target-player>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9a4afd6d/frameworks/projects/Mobile/compile-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Mobile/compile-config.xml b/frameworks/projects/Mobile/compile-config.xml
index 1738229..8a4b4ed 100644
--- a/frameworks/projects/Mobile/compile-config.xml
+++ b/frameworks/projects/Mobile/compile-config.xml
@@ -52,6 +52,10 @@
                 <uri>library://ns.apache.org/flexjs/basic</uri>
                 <manifest>basic-manifest.xml</manifest>
             </namespace>
+            <namespace>
+                <uri>library://ns.apache.org/flexjs/cordova</uri>
+                <manifest>cordova-manifest.xml</manifest>
+            </namespace>
         </namespaces>
         
         <source-path>
@@ -76,6 +80,7 @@
     
     <include-namespaces>
         <uri>library://ns.apache.org/flexjs/basic</uri>
+        <uri>library://ns.apache.org/flexjs/cordova</uri>
     </include-namespaces>
         
     <target-player>${playerglobal.version}</target-player>


[3/3] git commit: [flex-asjs] [refs/heads/core_js_to_as] - clean compile of DataGridExample

Posted by ah...@apache.org.
clean compile of DataGridExample


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/8a3755f2
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/8a3755f2
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/8a3755f2

Branch: refs/heads/core_js_to_as
Commit: 8a3755f292fa9df3eb4b6d2f9230a0f17a58e0d3
Parents: 0c9e438
Author: Alex Harui <ah...@apache.org>
Authored: Fri Dec 11 15:37:41 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Dec 11 15:37:41 2015 -0800

----------------------------------------------------------------------
 examples/flexjs/DataGridExample/build.xml | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8a3755f2/examples/flexjs/DataGridExample/build.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/DataGridExample/build.xml b/examples/flexjs/DataGridExample/build.xml
index fd89f00..61ebd4a 100644
--- a/examples/flexjs/DataGridExample/build.xml
+++ b/examples/flexjs/DataGridExample/build.xml
@@ -57,6 +57,8 @@
     property="GOOG_HOME"
     value="${FLEXJS_HOME}/js/lib/google/closure-library"/>
         
+    <property name="extlib_arg" value="-external-library-path=${FALCONJX_HOME}/../externs/js/out/bin/js.swc"/>
+    
     <include file="${basedir}/../../build_example.xml" />
 
     <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">


[2/3] git commit: [flex-asjs] [refs/heads/core_js_to_as] - clean up Graphics JS code

Posted by ah...@apache.org.
clean up Graphics JS code


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/0c9e438d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/0c9e438d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/0c9e438d

Branch: refs/heads/core_js_to_as
Commit: 0c9e438deea2df9d940fe7e35df11ca2ade94f8b
Parents: 9a4afd6
Author: Alex Harui <ah...@apache.org>
Authored: Fri Dec 11 15:37:20 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Dec 11 15:37:20 2015 -0800

----------------------------------------------------------------------
 .../Graphics/as/src/org/apache/flex/core/graphics/SolidColor.as    | 2 +-
 .../projects/Graphics/as/src/org/apache/flex/core/graphics/Text.as | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0c9e438d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColor.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColor.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColor.as
index 700c3bc..73e99b0 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColor.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColor.as
@@ -102,7 +102,7 @@ package org.apache.flex.core.graphics
         COMPILE::JS
         public function addFillAttrib(value:GraphicShape):String
         {
-            var color:String = Number(color).toString(16);
+            var color:String = Number(this.color).toString(16);
             if (color.length == 1) color = '00' + color;
             if (color.length == 2) color = '00' + color;
             if (color.length == 4) color = '00' + color;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0c9e438d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Text.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Text.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Text.as
index 1773c1e..24dd840 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Text.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Text.as
@@ -36,6 +36,8 @@ package org.apache.flex.core.graphics
 	 *  @playerversion Flash 10.2
 	 *  @playerversion AIR 2.6
 	 *  @productversion FlexJS 0.0
+     *  // TODO (aharui) ignore imports of external linkage interfaces?
+     *  @flexjsignoreimport SVGLocatable
 	 */
 	public class Text extends GraphicShape
 	{