flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [6/8] git commit: [flex-asjs] [refs/heads/core_js_to_as] - fix more issues now that airglobal/playerglobal not used in cross-compile
Date Sun, 18 Oct 2015 05:35:14 GMT
fix more issues now that airglobal/playerglobal not used in cross-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/8f4aa279
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/8f4aa279
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/8f4aa279

Branch: refs/heads/core_js_to_as
Commit: 8f4aa279c55fb9fcf93821ed27ebba5a51e26630
Parents: d94ca10
Author: Alex Harui <aharui@apache.org>
Authored: Thu Oct 15 09:20:10 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Thu Oct 15 09:20:10 2015 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/core/ApplicationBase.as | 12 +----
 .../src/org/apache/flex/core/BrowserScroller.as | 31 +++++++-----
 .../src/org/apache/flex/core/BrowserWindow.as   | 16 ++++--
 .../src/org/apache/flex/core/CSSFontFaceBead.as | 52 +++++++++++++-------
 .../src/org/apache/flex/core/ContainerBase.as   |  8 +--
 .../src/org/apache/flex/core/FilledRectangle.as | 33 ++++++++++---
 .../as/src/org/apache/flex/core/ListBase.as     |  3 --
 .../org/apache/flex/core/SimpleCSSValuesImpl.as | 12 +++--
 .../org/apache/flex/core/SimpleStatesImpl.as    |  7 ++-
 .../Core/as/src/org/apache/flex/core/UIBase.as  | 10 ++--
 .../src/org/apache/flex/utils/MixinManager.as   |  5 +-
 11 files changed, 118 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f4aa279/frameworks/projects/Core/as/src/org/apache/flex/core/ApplicationBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ApplicationBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ApplicationBase.as
index 84ec60e..70d6424 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/ApplicationBase.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/ApplicationBase.as
@@ -18,11 +18,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.core
 {
-    import flash.system.ApplicationDomain;
-    import flash.utils.getQualifiedClassName;
-
     COMPILE::AS3 {
         import flash.display.Sprite;
+        import flash.system.ApplicationDomain;
+        import flash.utils.getQualifiedClassName;
     }
         
     /**
@@ -103,13 +102,6 @@ package org.apache.flex.core
          */
         public function info():Object
         {
-            if (!_info)
-            {
-                var mainClassName:String = getQualifiedClassName(this);
-                var initClassName:String = "_" + mainClassName + "_FlexInit";
-                var c:Class = ApplicationDomain.currentDomain.getDefinition(initClassName)
as Class;
-                _info = c.info();
-            }
             return _info;
         }
         

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f4aa279/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserScroller.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserScroller.as b/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserScroller.as
index 544c056..670f503 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserScroller.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserScroller.as
@@ -18,9 +18,11 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.core
 {
-    import flash.external.ExternalInterface;
-    import flash.utils.getQualifiedClassName;
-    
+    COMPILE::AS3
+    {        
+        import flash.external.ExternalInterface;
+        import flash.utils.getQualifiedClassName;
+    }    
     import org.apache.flex.events.Event;
     
     /**
@@ -64,15 +66,22 @@ package org.apache.flex.core
         
         private function viewChangedHandler(event:Event):void
         {
-            if (ExternalInterface.available)
+            COMPILE::AS3
+            {
+                if (ExternalInterface.available)
+                {
+                    // Get application name.  This assumes that the wrapper is using an
+                    // object tag with the id that matches the application name
+                    var appName:String = getQualifiedClassName(app);
+                    var js:String = "var o = document.getElementById('" + appName + "');";
+                    js += "o.width = " + app.initialView.width.toString() + ";";
+                    js += "o.height = " + app.initialView.height.toString() + ";"
+                    ExternalInterface.call("eval", js); 
+                }                    
+            }
+            COMPILE::JS
             {
-                // Get application name.  This assumes that the wrapper is using an
-                // object tag with the id that matches the application name
-                var appName:String = getQualifiedClassName(app);
-                var js:String = "var o = document.getElementById('" + appName + "');";
-                js += "o.width = " + app.initialView.width.toString() + ";";
-                js += "o.height = " + app.initialView.height.toString() + ";"
-                ExternalInterface.call("eval", js); 
+                app.element.style.overflow = 'auto';
             }
         }
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f4aa279/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserWindow.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserWindow.as b/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserWindow.as
index 91ba7ed..ecaf8c3 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserWindow.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/BrowserWindow.as
@@ -18,8 +18,11 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.core
 {
-    import flash.net.navigateToURL;
-    import flash.net.URLRequest;
+    COMPILE::AS3
+    {
+        import flash.net.navigateToURL;
+        import flash.net.URLRequest;            
+    }
     
     /**
      *  The BrowserWindow class opens a new browser window.
@@ -45,7 +48,14 @@ package org.apache.flex.core
 		
         public static function open(url:String, options:String):void
         {
-            navigateToURL(new URLRequest(url), options);
+            COMPILE::AS3
+            {
+                navigateToURL(new URLRequest(url), options);                    
+            }
+            COMPILE::JS
+            {
+                window.open(url, options);
+            }
         }
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f4aa279/frameworks/projects/Core/as/src/org/apache/flex/core/CSSFontFaceBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/CSSFontFaceBead.as b/frameworks/projects/Core/as/src/org/apache/flex/core/CSSFontFaceBead.as
index a847300..c601fd7 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/CSSFontFaceBead.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/CSSFontFaceBead.as
@@ -18,23 +18,27 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.core
 {
-    import flash.display.Loader;
-    import flash.system.LoaderContext;
-    import flash.events.Event;
-    import flash.events.IOErrorEvent;
-    import flash.events.SecurityErrorEvent;
-    import flash.net.URLRequest;
-    import flash.system.ApplicationDomain;
-    import flash.utils.getQualifiedClassName;
-    
-    import org.apache.flex.events.Event;
-    import org.apache.flex.events.IEventDispatcher;
-    import org.apache.flex.events.ValueEvent;
+    COMPILE::AS3
+    {
+        import flash.display.Loader;
+        import flash.system.LoaderContext;
+        import flash.events.Event;
+        import flash.events.IOErrorEvent;
+        import flash.events.SecurityErrorEvent;
+        import flash.net.URLRequest;
+        import flash.system.ApplicationDomain;
+        import flash.utils.getQualifiedClassName;
+        
+        import org.apache.flex.events.Event;
+        import org.apache.flex.events.IEventDispatcher;
+        import org.apache.flex.events.ValueEvent;            
+    }
     
     /**
      *  The CSSFontFaceBead class is the class that loads swfs
      *  of converted fonts so they can be used in Flash.
-     *  
+     *  It is just a stub in JS.
+     * 
      *  @langversion 3.0
      *  @playerversion Flash 10.2
      *  @playerversion AIR 2.6
@@ -67,16 +71,21 @@ package org.apache.flex.core
         public function set strand(value:IStrand):void
         {
             _strand = value;
-            IEventDispatcher(ValuesManager.valuesImpl).addEventListener("init", initHandler);
-            IEventDispatcher(_strand).addEventListener("preinitialize", preinitHandler);
-            var mainClassName:String = getQualifiedClassName(value);
-            var styleClassName:String = "_" + mainClassName + "_Styles";
-            var c:Class = ApplicationDomain.currentDomain.getDefinition(styleClassName) as
Class;
-            requestFonts(c["fontFaces"]);
+            COMPILE::AS3
+            {
+                IEventDispatcher(ValuesManager.valuesImpl).addEventListener("init", initHandler);
+                IEventDispatcher(_strand).addEventListener("preinitialize", preinitHandler);
+                var mainClassName:String = getQualifiedClassName(value);
+                var styleClassName:String = "_" + mainClassName + "_Styles";
+                var c:Class = ApplicationDomain.currentDomain.getDefinition(styleClassName)
as Class;
+                requestFonts(c["fontFaces"]);                    
+            }
         }
             
+        COMPILE::AS3
         private var loaders:Array;
         
+        COMPILE::AS3
         private function initHandler(event:ValueEvent):void
         {
             var fontFaces:Array = event.value as Array;
@@ -84,6 +93,7 @@ package org.apache.flex.core
                 requestFonts(fontFaces);
         }
         
+        COMPILE::AS3
         private function requestFonts(fontFaces:Array):void
         {
             if (!loaders)
@@ -112,17 +122,20 @@ package org.apache.flex.core
             }
         }
         
+        COMPILE::AS3
         private function completeHandler(event:flash.events.Event):void
         {
             removeTarget(event.target);
         }
         
+        COMPILE::AS3
         private function errorHandler(event:flash.events.Event):void
         {
             trace("error loading font from: ", event.target.name);
             removeTarget(event.target);
         }
         
+        COMPILE::AS3
         private function removeTarget(target:Object):void
         {
             var n:int = loaders.length;
@@ -138,6 +151,7 @@ package org.apache.flex.core
             }
         }
                 
+        COMPILE::AS3
         private function preinitHandler(event:org.apache.flex.events.Event):void
         {
             event.preventDefault();

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f4aa279/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as
index b483ba9..5cd45c9 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/ContainerBase.as
@@ -18,9 +18,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.core
 {
-	import flash.display.DisplayObject;
-	import flash.display.DisplayObjectContainer;
-	
 	import org.apache.flex.core.IMXMLDocument;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
@@ -372,7 +369,10 @@ package org.apache.flex.core
 			//TODO:  Need to handle this case more gracefully
 			catch(e:Error)
 			{
-				trace(e.message);
+                COMPILE::AS3
+                {
+                    trace(e.message);                        
+                }
 			}
             
         }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f4aa279/frameworks/projects/Core/as/src/org/apache/flex/core/FilledRectangle.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/FilledRectangle.as b/frameworks/projects/Core/as/src/org/apache/flex/core/FilledRectangle.as
index f18f54b..2fcf8dd 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/FilledRectangle.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/FilledRectangle.as
@@ -18,7 +18,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.core
 {
-	import flash.display.Shape;
+    COMPILE::AS3
+    {
+        import flash.display.Shape;            
+    }
 	
 	import org.apache.flex.core.UIBase;
 	
@@ -45,10 +48,14 @@ package org.apache.flex.core
 		{
 			super();
 			
-			_shape = new flash.display.Shape();
-			this.addElement(_shape);
+            COMPILE::AS3
+            {
+                _shape = new flash.display.Shape();
+                this.addElement(_shape);
+            }
 		}
 		
+        COMPILE::AS3
 		private var _shape:flash.display.Shape;
 		
 		private var _fillColor:uint = 0x000000;
@@ -97,10 +104,22 @@ package org.apache.flex.core
          */
 		public function drawRect(x:Number, y:Number, width:Number, height:Number):void
 		{
-			_shape.graphics.clear();
-			_shape.graphics.beginFill(_fillColor);
-			_shape.graphics.drawRect(x, y, width, height);
-			_shape.graphics.endFill();
+            COMPILE::AS3
+            {
+                _shape.graphics.clear();
+                _shape.graphics.beginFill(_fillColor);
+                _shape.graphics.drawRect(x, y, width, height);
+                _shape.graphics.endFill();                    
+            }
+            COMPILE::JS
+            {
+                element.style.position = 'absolute';
+                element.style.backgroundColor = '#' + _fillColor.toString(16);
+                if (!isNaN(x)) this.x = x;
+                if (!isNaN(y)) this.y = y;
+                if (!isNaN(width)) this.width = width;
+                if (!isNaN(height)) this.height = height;
+            }
 		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f4aa279/frameworks/projects/Core/as/src/org/apache/flex/core/ListBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/ListBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/ListBase.as
index 48c3438..0d515b9 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/ListBase.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/ListBase.as
@@ -18,9 +18,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.core
 {
-	import flash.display.DisplayObject;
-	import flash.display.DisplayObjectContainer;
-	
 	import org.apache.flex.core.IMXMLDocument;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f4aa279/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleCSSValuesImpl.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleCSSValuesImpl.as b/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleCSSValuesImpl.as
index d02a985..362a5ad 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleCSSValuesImpl.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleCSSValuesImpl.as
@@ -18,11 +18,13 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.core
 {
-	import flash.display.JointStyle;
-	import flash.system.ApplicationDomain;
-	import flash.utils.getDefinitionByName;
-	import flash.utils.getQualifiedClassName;
-	import flash.utils.getQualifiedSuperclassName;
+    COMPILE::AS3
+    {
+        import flash.system.ApplicationDomain;
+        import flash.utils.getDefinitionByName;
+        import flash.utils.getQualifiedClassName;
+        import flash.utils.getQualifiedSuperclassName;            
+    }
 	
 	import org.apache.flex.events.EventDispatcher;
 	import org.apache.flex.events.ValueChangeEvent;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f4aa279/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleStatesImpl.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleStatesImpl.as b/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleStatesImpl.as
index 4ccddd1..4a27318 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleStatesImpl.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleStatesImpl.as
@@ -18,13 +18,12 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.core
 {
-    import flash.display.DisplayObject;
-    
     import org.apache.flex.states.AddItems;
     import org.apache.flex.states.SetEventHandler;
     import org.apache.flex.states.SetProperty;
     import org.apache.flex.states.State;
     
+    import org.apache.flex.core.IChild;
     import org.apache.flex.core.IParent;
     import org.apache.flex.core.IStatesObject;
     import org.apache.flex.events.Event;
@@ -118,7 +117,7 @@ package org.apache.flex.core
                 if (o is AddItems)
                 {
                     var ai:AddItems = AddItems(o);
-                    for each (var item:DisplayObject in ai.items)
+                    for each (var item:IChild in ai.items)
                     {
                         var parent:IParent = item.parent as IParent;
                         parent.removeElement(item);
@@ -168,7 +167,7 @@ package org.apache.flex.core
                             ai.itemsDescriptor.items = ai.items;
                         }
                     }
-                    for each (var item:DisplayObject in ai.items)
+                    for each (var item:IChild in ai.items)
                     {
                         var parent:IParent = ai.document as IParent;
                         if (ai.destination != null)

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f4aa279/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
index be8e5f2..12b09b9 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as
@@ -18,10 +18,12 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.core
 {
-	import flash.display.DisplayObject;
-	import flash.display.JointStyle;
-	import flash.display.Sprite;
-	import flash.display.Stage;
+    COMPILE::AS3
+    {
+        import flash.display.DisplayObject;
+        import flash.display.Sprite;
+        import flash.display.Stage;            
+    }
 	
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8f4aa279/frameworks/projects/Core/as/src/org/apache/flex/utils/MixinManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/utils/MixinManager.as b/frameworks/projects/Core/as/src/org/apache/flex/utils/MixinManager.as
index 9ad450a..ab5dfed 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/utils/MixinManager.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/utils/MixinManager.as
@@ -19,7 +19,10 @@
 package org.apache.flex.utils
 {
 
-import flash.system.ApplicationDomain;
+COMPILE::AS3
+{
+    import flash.system.ApplicationDomain;            
+}
 
 import org.apache.flex.core.IBead;
 import org.apache.flex.core.IFlexInfo;


Mime
View raw message