flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [2/2] git commit: [flex-asjs] [refs/heads/core_js_to_as] - clean compile of Graphics
Date Mon, 09 Nov 2015 07:06:29 GMT
clean compile of Graphics


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

Branch: refs/heads/core_js_to_as
Commit: 9cb1f75d29e21dcdc6fc9a4cdd1932deed22b02e
Parents: e12fc80
Author: Alex Harui <aharui@apache.org>
Authored: Sun Nov 8 22:21:14 2015 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Sun Nov 8 23:06:17 2015 -0800

----------------------------------------------------------------------
 .../projects/Graphics/as/src/GraphicsClasses.as |   1 -
 .../src/org/apache/flex/core/graphics/Circle.as |  52 ++++-
 .../org/apache/flex/core/graphics/Ellipse.as    |  53 ++++-
 .../apache/flex/core/graphics/GradientBase.as   |  19 +-
 .../apache/flex/core/graphics/GradientEntry.as  |  10 +-
 .../apache/flex/core/graphics/GraphicShape.as   | 114 ++++++++++-
 .../flex/core/graphics/GraphicsContainer.as     | 204 ++++++++++++++-----
 .../src/org/apache/flex/core/graphics/IFill.as  |  11 +-
 .../org/apache/flex/core/graphics/IStroke.as    |   8 +
 .../apache/flex/core/graphics/LinearGradient.as |  79 ++++++-
 .../src/org/apache/flex/core/graphics/Path.as   |  58 ++++--
 .../src/org/apache/flex/core/graphics/Rect.as   |  53 ++++-
 .../org/apache/flex/core/graphics/SolidColor.as |  25 ++-
 .../flex/core/graphics/SolidColorStroke.as      |  25 ++-
 .../src/org/apache/flex/core/graphics/Text.as   |  81 ++++++--
 frameworks/projects/Graphics/build.xml          |  90 +++++---
 .../projects/Graphics/compile-asjs-config.xml   |  82 ++++++++
 frameworks/projects/Graphics/compile-config.xml |   4 +-
 18 files changed, 810 insertions(+), 159 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/GraphicsClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/GraphicsClasses.as b/frameworks/projects/Graphics/as/src/GraphicsClasses.as
index 1378f23..c463f04 100644
--- a/frameworks/projects/Graphics/as/src/GraphicsClasses.as
+++ b/frameworks/projects/Graphics/as/src/GraphicsClasses.as
@@ -38,7 +38,6 @@ internal class GraphicsClasses
 	import org.apache.flex.core.graphics.Text; Text;
 	import org.apache.flex.core.graphics.GraphicsContainer; GraphicsContainer;
 	import org.apache.flex.core.graphics.LinearGradient; LinearGradient;
-    import org.apache.flex.core.DataBindingBase; DataBindingBase;
 }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Circle.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Circle.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Circle.as
index e67e97f..8868bec 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Circle.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Circle.as
@@ -14,8 +14,15 @@
 
 package org.apache.flex.core.graphics
 {
-	import flash.geom.Point;
-	import flash.geom.Rectangle;
+    COMPILE::AS3
+    {
+        import flash.geom.Point;
+        import flash.geom.Rectangle;            
+    }
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;
+    }
 
 	public class Circle extends GraphicShape
 	{
@@ -41,14 +48,45 @@ package org.apache.flex.core.graphics
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
+         *  @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+         *  @flexjsignorecoercion SVGCircleElement
 		 */
 		public function drawCircle(x:Number, y:Number, radius:Number):void
 		{
-			graphics.clear();
-			applyStroke();
-			beginFill(new Rectangle(x,y,radius*2, radius*2),new Point(x-radius,y-radius));
-			graphics.drawCircle(x,y,radius);
-			endFill();
+            COMPILE::AS3
+            {
+                graphics.clear();
+                applyStroke();
+                beginFill(new Rectangle(x,y,radius*2, radius*2),new Point(x-radius,y-radius));
+                graphics.drawCircle(x,y,radius);
+                endFill();
+            }
+            COMPILE::JS                
+            {
+                var style:String = getStyleStr();
+                var circle:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
+                circle.flexjs_wrapper = this;
+                circle.setAttribute('style', style);
+                if (stroke)
+                {
+                    circle.setAttribute('cx', String(radius + stroke.weight));
+                    circle.setAttribute('cy', String(radius + stroke.weight));
+                    setPosition(x - radius, y - radius, stroke.weight, stroke.weight);
+                }
+                else
+                {
+                    circle.setAttribute('cx', String(radius));
+                    circle.setAttribute('cy', String(radius));
+                    setPosition(x - radius, y - radius, 0, 0);
+                }
+                
+                circle.setAttribute('rx', String(radius));
+                circle.setAttribute('ry', String(radius));
+                element.appendChild(circle);
+                
+                resize(x, y, (circle as SVGCircleElement).getBBox());
+
+            }
 		}
 		
 		override public function addedToParent():void

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Ellipse.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Ellipse.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Ellipse.as
index 7b8db56..f22161f 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Ellipse.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Ellipse.as
@@ -18,8 +18,15 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.core.graphics
 {
-	import flash.geom.Point;
-	import flash.geom.Rectangle;
+    COMPILE::AS3
+    {
+        import flash.geom.Point;
+        import flash.geom.Rectangle;            
+    }
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;
+    }
 
 	public class Ellipse extends GraphicShape
 	{
@@ -35,19 +42,49 @@ package org.apache.flex.core.graphics
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
+         *  @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+         *  @flexjsignorecoercion SVGEllipseElement
 		 */
 		public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void
 		{
-			graphics.clear();
-			applyStroke();
-			beginFill(new Rectangle(x, y, width, height), new Point(x,y));
-			graphics.drawEllipse(x,y,width,height);
-			endFill();
+            COMPILE::AS3
+            {
+                graphics.clear();
+                applyStroke();
+                beginFill(new Rectangle(x, y, width, height), new Point(x,y));
+                graphics.drawEllipse(x,y,width,height);
+                endFill();                    
+            }
+            COMPILE::JS
+            {
+                var style:String = getStyleStr();
+                var ellipse:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
+                ellipse.flexjs_wrapper = this;
+                ellipse.setAttribute('style', style);
+                if (stroke)
+                {
+                    ellipse.setAttribute('cx', String(width / 2 + stroke.weight));
+                    ellipse.setAttribute('cy', String(height / 2 + stroke.weight));
+                    setPosition(x, y, stroke.weight * 2, stroke.weight * 2);
+                }
+                else
+                {
+                    ellipse.setAttribute('cx', String(width / 2));
+                    ellipse.setAttribute('cy', String(height / 2));
+                    setPosition(x, y, 0, 0);
+                }
+                ellipse.setAttribute('rx', String(width / 2));
+                ellipse.setAttribute('ry', String(height / 2));
+                element.appendChild(ellipse);
+                
+                resize(x, y, (ellipse as SVGEllipseElement).getBBox());
+
+            }
 		}
 		
 		override protected function draw():void
 		{
-			this.drawEllipse(0, 0, width, height);	
+			drawEllipse(0, 0, width, height);	
 		}
 		
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientBase.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientBase.as
index ad23d5a..58d417a 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientBase.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientBase.as
@@ -33,6 +33,7 @@ package org.apache.flex.core.graphics
 		 *  @playerversion Flash 9
 		 *  @playerversion AIR 1.1
 		 */
+        COMPILE::AS3
 		protected var compoundTransform:CompoundTransform;
 		
 		/**
@@ -44,6 +45,14 @@ package org.apache.flex.core.graphics
 		 */ 
 		public static const GRADIENT_DIMENSION:Number = 1638.4;
 		
+        /**
+         *  generate uid
+         */
+        public function get newId():String
+        {
+            return 'gradient' + String(Math.floor((Math.random() * 100000) + 1));
+        }
+
 		/**
 		 *  Storage for the entries property.
 		 */
@@ -71,7 +80,10 @@ package org.apache.flex.core.graphics
 		public function set entries(value:Array):void
 		{
 			_entries = value;
-			processEntries();
+            COMPILE::AS3
+            {
+                processEntries();                    
+            }
 		}
 		
 		/**
@@ -138,12 +150,12 @@ package org.apache.flex.core.graphics
 			_y = value;                
 		}
 
-		
+		COMPILE::AS3
 		protected function toRad(a:Number):Number {
 			return a*Math.PI/180;
 		}
 		
-		
+		COMPILE::AS3
 		protected function get rotationInRadians():Number
 		{
 			return rotation / 180 * Math.PI;
@@ -155,6 +167,7 @@ package org.apache.flex.core.graphics
 		 *  Array into the internal <code>colors</code>, <code>ratios</code>,
 		 *  and <code>alphas</code> arrays.
 		 */
+        COMPILE::AS3
 		private function processEntries():void
 		{
 			colors = [];

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientEntry.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientEntry.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientEntry.as
index 0124c13..cbcdb3f 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientEntry.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GradientEntry.as
@@ -112,7 +112,10 @@ package org.apache.flex.core.graphics
 		 */
 		public function begin(s:GraphicShape):void
 		{
-			s.graphics.beginFill(color,alpha);
+            COMPILE::AS3
+            {
+                s.graphics.beginFill(color,alpha);                    
+            }
 		}
 		
 		/**
@@ -120,7 +123,10 @@ package org.apache.flex.core.graphics
 		 */
 		public function end(s:GraphicShape):void
 		{
-			s.graphics.endFill();
+            COMPILE::AS3
+            {
+    			s.graphics.endFill();
+            }
 		}
 
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicShape.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicShape.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicShape.as
index 0b04b39..b19ddb1 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicShape.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicShape.as
@@ -14,9 +14,15 @@
 
 package org.apache.flex.core.graphics
 {
-	
-	import flash.geom.Point;
-	import flash.geom.Rectangle;
+	COMPILE::AS3
+    {
+        import flash.geom.Point;
+        import flash.geom.Rectangle;            
+    }
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;        
+    }
 	
 	import org.apache.flex.core.UIBase;
 	
@@ -60,6 +66,21 @@ package org.apache.flex.core.graphics
 			_fill = value;
 		}
 		
+        public function GraphicShape()
+        {
+            COMPILE::JS
+            {
+                element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as WrappedHTMLElement;
+                element.flexjs_wrapper = this;
+                element.offsetLeft = 0;
+                element.offsetTop = 0;
+                element.offsetParent = null;
+                positioner = element;
+                positioner.style.position = 'relative';                        
+            }
+        }
+        
+        COMPILE::AS3
 		protected function applyStroke():void
 		{
 			if(stroke)
@@ -68,6 +89,7 @@ package org.apache.flex.core.graphics
 			}
 		}
 		
+        COMPILE::AS3
 		protected function beginFill(targetBounds:Rectangle,targetOrigin:Point):void
 		{
 			if(fill)
@@ -76,6 +98,7 @@ package org.apache.flex.core.graphics
 			}
 		}
 		
+        COMPILE::AS3
 		protected function endFill():void
 		{
 			if(fill)
@@ -94,9 +117,92 @@ package org.apache.flex.core.graphics
 		
 		override public function addedToParent():void
 		{
-			super.addedToParent();
+            COMPILE::AS3
+            {
+                super.addedToParent();                    
+            }
 			draw();
+            COMPILE::JS
+            {
+                element.style.overflow = 'visible';                    
+            }
 		}
 		
+        /**
+         * @return {string} The style attribute.
+         */
+        COMPILE::JS
+        public function getStyleStr():String
+        {
+            var fillStr:String;
+            if (fill)
+            {
+                fillStr = fill.addFillAttrib(this);
+            }
+            else
+            {
+                fillStr = 'fill:none';
+            }
+            
+            var strokeStr:String;
+            if (stroke)
+            {
+                strokeStr = stroke.addStrokeAttrib(this);
+            }
+            else
+            {
+                strokeStr = 'stroke:none';
+            }
+            
+            
+            return fillStr + ';' + strokeStr;
+        }
+        
+        
+        /**
+         * @param x X position.
+         * @param y Y position.
+         * @param bbox The bounding box of the svg element.
+         */
+        COMPILE::JS
+        public function resize(x:Number, y:Number, bbox:SVGRect):void
+        {
+            var width:Number = Math.max(width, bbox.width);
+            var height:Number = Math.max(height, bbox.height);
+            
+            element.style.position = 'absolute';
+            if (!isNaN(x)) element.style.top = String(x) + 'px';
+            if (!isNaN(y)) element.style.left = String(y) + 'px';
+            element.style.width = String(width) + 'px';
+            element.style.height = String(height) + 'px';
+            element.offsetLeft = x;
+            element.offsetTop = y;
+        }
+
+        COMPILE::JS
+        private var _x:Number;
+        COMPILE::JS
+        private var _y:Number;
+        COMPILE::JS
+        private var _xOffset:Number;
+        COMPILE::JS
+        private var _yOffset:Number;
+        
+        /**
+         * @param x X position.
+         * @param y Y position.
+         * @param xOffset offset from x position.
+         * @param yOffset offset from y position.
+         */
+        COMPILE::JS
+        public function setPosition(x:Number, y:Number, xOffset:Number, yOffset:Number):void
+        {
+            _x = x;
+            _y = y;
+            _xOffset = xOffset;
+            _yOffset = yOffset;
+            element.offsetLeft = xOffset;
+            element.offsetTop = yOffset;
+        }
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as
index f82b25e..f232117 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as
@@ -14,14 +14,21 @@
  
 package org.apache.flex.core.graphics
 {
-	import flash.display.GraphicsPath;
-	import flash.display.Shape;
-	import flash.display.Sprite;
-	import flash.geom.Point;
-	import flash.geom.Rectangle;
-	import flash.text.TextFieldType;
-	
-	import org.apache.flex.core.CSSTextField;
+    COMPILE::AS3
+    {
+        import flash.display.GraphicsPath;
+        import flash.display.Shape;
+        import flash.display.Sprite;
+        import flash.geom.Point;
+        import flash.geom.Rectangle;
+        import flash.text.TextFieldType;
+        
+        import org.apache.flex.core.CSSTextField;            
+    }
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;
+    }
 	import org.apache.flex.core.graphics.utils.PathHelper;
 	
 	/**
@@ -44,7 +51,17 @@ package org.apache.flex.core.graphics
 		 */
 		public function removeAllElements():void
 		{
-			graphics.clear();
+            COMPILE::AS3
+            {
+                graphics.clear();                    
+            }
+            COMPILE::JS
+            {
+                var svg:HTMLElement = element;
+                while (svg.lastChild) {
+                    svg.removeChild(svg.lastChild);
+                }
+            }
 		}
 		
 		/**
@@ -58,15 +75,34 @@ package org.apache.flex.core.graphics
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0.3
+         *  @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
 		 */
 		public function drawRect(x:Number, y:Number, width:Number, height:Number):void
 		{
-			applyStroke();
-			beginFill(new Rectangle(x, y, width, height), new Point(x,y) );
-			graphics.drawRect(x, y, width, height);
-			endFill();
+            COMPILE::AS3
+            {
+                applyStroke();
+                beginFill(new Rectangle(x, y, width, height), new Point(x,y) );
+                graphics.drawRect(x, y, width, height);
+                endFill();                    
+            }
+            COMPILE::JS
+            {
+                var style:String = getStyleStr();
+                var rect:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement;
+                rect.flexjs_wrapper = this;
+                rect.offsetLeft = x;
+                rect.offsetTop = y;
+                rect.setAttribute('style', style);
+                rect.setAttribute('x', String(x) + 'px');
+                rect.setAttribute('y', String(y) + 'px');
+                rect.setAttribute('width', String(width) + 'px');
+                rect.setAttribute('height', String(height) + 'px');
+                element.appendChild(rect);
+            }
 		}
 		
+        COMPILE::AS3
 		public function createRect(x:Number, y:Number, width:Number, height:Number):void
 		{
 			var color:uint = (fill as SolidColor).color;
@@ -78,7 +114,7 @@ package org.apache.flex.core.graphics
 			shape.graphics.endFill();
 			shape.x = x;
 			shape.y = y;
-			this.addChild(shape);
+			addChild(shape);
 		}
 		
 		/**
@@ -92,13 +128,31 @@ package org.apache.flex.core.graphics
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0.3
+         *  @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
 		 */
 		public function drawEllipse(x:Number, y:Number, width:Number, height:Number):void
 		{
-			applyStroke();
-			beginFill(new Rectangle(x,y,width,height), new Point(x,y));
-			graphics.drawEllipse(x,y,width,height);
-			endFill();
+            COMPILE::AS3
+            {
+                applyStroke();
+                beginFill(new Rectangle(x,y,width,height), new Point(x,y));
+                graphics.drawEllipse(x,y,width,height);
+                endFill();                    
+            }
+            COMPILE::JS
+            {
+                var style:String = getStyleStr();
+                var ellipse:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
+                ellipse.flexjs_wrapper = this;
+                ellipse.offsetLeft = x;
+                ellipse.offsetTop = y;
+                ellipse.setAttribute('style', style);
+                ellipse.setAttribute('cx', String(x + width / 2));
+                ellipse.setAttribute('cy', String(y + height / 2));
+                ellipse.setAttribute('rx', String(width / 2));
+                ellipse.setAttribute('ry', String(height / 2));
+                element.appendChild(ellipse);
+            }
 		}
 		
 		/**
@@ -111,13 +165,32 @@ package org.apache.flex.core.graphics
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
+         *  @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
 		 */
 		public function drawCircle(x:Number, y:Number, radius:Number):void
 		{
-			applyStroke();
-			beginFill(new Rectangle(x,y,radius*2, radius*2),new Point(x-radius,y-radius));
-			graphics.drawCircle(x,y,radius);
-			endFill();
+            COMPILE::AS3
+            {
+                applyStroke();
+                beginFill(new Rectangle(x,y,radius*2, radius*2),new Point(x-radius,y-radius));
+                graphics.drawCircle(x,y,radius);
+                endFill();                    
+            }
+            COMPILE::JS
+            {
+                var style:String = getStyleStr();
+                var circle:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'ellipse') as WrappedHTMLElement;
+                circle.flexjs_wrapper = this;
+                circle.offsetLeft = x;
+                circle.offsetTop = y;
+                circle.setAttribute('style', style);
+                circle.setAttribute('cx', String(x));
+                circle.setAttribute('cy', String(y));
+                circle.setAttribute('rx', String(radius));
+                circle.setAttribute('ry', String(radius));
+                element.appendChild(circle);
+
+            }
 		}
 		
 		/**
@@ -134,15 +207,30 @@ package org.apache.flex.core.graphics
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
+         *  @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
 		 */
 		public function drawPath(data:String):void
 		{
-			applyStroke();
-			var bounds:Rectangle = PathHelper.getBounds(data);
-			beginFill(bounds,bounds.topLeft);
-			var graphicsPath:GraphicsPath = PathHelper.getSegments(data);
-			graphics.drawPath(graphicsPath.commands, graphicsPath.data);
-			endFill();
+            COMPILE::AS3
+            {
+                applyStroke();
+                var bounds:Rectangle = PathHelper.getBounds(data);
+                beginFill(bounds,bounds.topLeft);
+                var graphicsPath:GraphicsPath = PathHelper.getSegments(data);
+                graphics.drawPath(graphicsPath.commands, graphicsPath.data);
+                endFill();                    
+            }
+            COMPILE::JS
+            {
+                var style:String = getStyleStr();
+                var path:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'path') as WrappedHTMLElement;
+                path.flexjs_wrapper = this;
+                path.offsetLeft = 0;
+                path.offsetTop = 0;
+                path.setAttribute('style', style);
+                path.setAttribute('d', data);
+                element.appendChild(path);
+            }
 		}
 		
 		public function drawLine():void
@@ -165,28 +253,50 @@ package org.apache.flex.core.graphics
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
+         *  @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+         *  @flexjsignorecoercion Text
+         *  @flexjsignorecoercion Node
 		 */
 		public function drawText(value:String, x:Number, y:Number):Object
 		{
-			var textField:CSSTextField = new CSSTextField();
-			addChild(textField);
-			
-			textField.selectable = false;
-			textField.type = TextFieldType.DYNAMIC;
-			textField.mouseEnabled = false;
-			textField.autoSize = "left";
-			textField.text = value;
-			
-			var lineColor:SolidColorStroke = stroke as SolidColorStroke;
-			if (lineColor) {
-				textField.textColor = lineColor.color;
-				textField.alpha = lineColor.alpha;
-			}
-			
-			textField.x = x;
-			textField.y = y + textField.textHeight/4;
-			
-			return textField;
+            COMPILE::AS3
+            {
+                var textField:CSSTextField = new CSSTextField();
+                addChild(textField);
+                
+                textField.selectable = false;
+                textField.type = TextFieldType.DYNAMIC;
+                textField.mouseEnabled = false;
+                textField.autoSize = "left";
+                textField.text = value;
+                
+                var lineColor:SolidColorStroke = stroke as SolidColorStroke;
+                if (lineColor) {
+                    textField.textColor = lineColor.color;
+                    textField.alpha = lineColor.alpha;
+                }
+                
+                textField.x = x;
+                textField.y = y + textField.textHeight/4;
+                
+                return textField;
+                
+            }
+            COMPILE::JS
+            {
+                var style:String = getStyleStr();
+                var text:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'text') as WrappedHTMLElement;
+                text.flexjs_wrapper = this;
+                text.offsetLeft = x;
+                text.offsetTop = y;
+                text.setAttribute('style', style);
+                text.setAttribute('x', String(x) + 'px');
+                text.setAttribute('y', String(y + 15) + 'px');
+                var textNode:Text = document.createTextNode(value) as Text;
+                text.appendChild(textNode as Node);
+                element.appendChild(text);
+                return text;
+            }
 		}
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IFill.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IFill.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IFill.as
index 8e025d2..f0101ab 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IFill.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IFill.as
@@ -14,12 +14,19 @@
 
 package org.apache.flex.core.graphics
 {
-	import flash.geom.Point;
-	import flash.geom.Rectangle;
+    COMPILE::AS3
+    {
+        import flash.geom.Point;
+        import flash.geom.Rectangle;            
+    }
 
 	public interface IFill
 	{
+        COMPILE::AS3
 		function begin(s:GraphicShape,targetBounds:Rectangle, targetOrigin:Point):void;
+        COMPILE::AS3
 		function end(s:GraphicShape):void;
+        COMPILE::JS
+        function addFillAttrib(s:GraphicShape):String;
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IStroke.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IStroke.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IStroke.as
index 1433e85..be3f022 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IStroke.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/IStroke.as
@@ -16,6 +16,14 @@ package org.apache.flex.core.graphics
 {
 	public interface IStroke
 	{
+        COMPILE::AS3
 		function apply(s:GraphicShape):void;
+        
+        COMPILE::JS
+        function get weight():Number;
+        
+        COMPILE::JS
+        function addStrokeAttrib(s:GraphicShape):String;
+
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/LinearGradient.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/LinearGradient.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/LinearGradient.as
index 6eee7c3..58fd116 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/LinearGradient.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/LinearGradient.as
@@ -14,17 +14,21 @@
 
 package org.apache.flex.core.graphics
 {
-	import flash.display.GradientType;
-	import flash.display.InterpolationMethod;
-	import flash.display.SpreadMethod;
-	import flash.geom.Matrix;
-	import flash.geom.Point;
-	import flash.geom.Rectangle;
+    COMPILE::AS3
+    {
+        import flash.display.GradientType;
+        import flash.display.InterpolationMethod;
+        import flash.display.SpreadMethod;
+        import flash.geom.Matrix;
+        import flash.geom.Point;
+        import flash.geom.Rectangle;            
+    }
 	
 	public class LinearGradient extends GradientBase implements IFill
 	{
-		
+		COMPILE::AS3
 		private static var commonMatrix:Matrix = new Matrix();
+        
 		private var _scaleX:Number;
 		
 		/**
@@ -40,6 +44,7 @@ package org.apache.flex.core.graphics
 			_scaleX = value;
 		}
 		
+        COMPILE::AS3
 		public function begin(s:GraphicShape,targetBounds:Rectangle, targetOrigin:Point):void
 		{
 			commonMatrix.identity();
@@ -50,9 +55,69 @@ package org.apache.flex.core.graphics
 			
 		}
 		
+        COMPILE::AS3
 		public function end(s:GraphicShape):void
 		{
 			s.graphics.endFill();
 		}
+        
+        /**
+         * addFillAttrib()
+         *
+         * @param value The GraphicShape object on which the fill must be added.
+         * @return {string}
+         * @flexjsignorecoercion Node
+         */
+        COMPILE::JS
+        public function addFillAttrib(value:GraphicShape):String 
+        {
+            //Create and add a linear gradient def
+            var svgNS:String = value.element.namespaceURI;
+            var grad:HTMLElement = document.createElementNS(svgNS, 'linearGradient') as HTMLElement;
+            var gradientId:String = this.newId;
+            grad.setAttribute('id', gradientId);
+            
+            //Set x1, y1, x2, y2 of gradient
+            grad.setAttribute('x1', '0%');
+            grad.setAttribute('y1', '0%');
+            grad.setAttribute('x2', '100%');
+            grad.setAttribute('y2', '0%');
+            
+            //Apply rotation to the gradient if rotation is a number
+            if (rotation)
+            {
+                grad.setAttribute('gradientTransform', 'rotate(' + rotation + ' 0.5 0.5)');
+            }
+            
+            //Process gradient entries and create a stop for each entry
+            var entries:Array = entries;
+            for (var i:int = 0; i < entries.length; i++)
+            {
+                var gradientEntry:GradientEntry = entries[i];
+                var stop:HTMLElement = document.createElementNS(svgNS, 'stop') as HTMLElement;
+                //Set Offset
+                stop.setAttribute('offset', String(gradientEntry.ratio * 100) + '%');
+                //Set Color
+                var color:String = Number(gradientEntry.color).toString(16);
+                if (color.length == 1) color = '00' + color;
+                if (color.length == 2) color = '00' + color;
+                if (color.length == 4) color = '00' + color;
+                stop.setAttribute('stop-color', '#' + String(color));
+                //Set Alpha
+                stop.setAttribute('stop-opacity', String(gradientEntry.alpha));
+                
+                grad.appendChild(stop);
+            }
+            
+            //Add defs element if not available already
+            //Add newly created gradient to defs element
+            var defs:Node = value.element.querySelector('defs') ||
+                value.element.insertBefore(document.createElementNS(svgNS, 'defs'), value.element.firstChild);
+            defs.appendChild(grad);
+            
+            //Return the fill attribute
+            return 'fill:url(#' + gradientId + ')';
+        }
+
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Path.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Path.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Path.as
index e02dd95..b039af9 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Path.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Path.as
@@ -14,10 +14,17 @@
 
 package org.apache.flex.core.graphics
 {
-	import flash.display.GraphicsPath;
-	import flash.geom.Point;
-	import flash.geom.Rectangle;
-	
+    COMPILE::AS3
+    {
+        import flash.display.GraphicsPath;
+        import flash.geom.Point;
+        import flash.geom.Rectangle;            
+    }
+	COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;
+    }
+    
 	import org.apache.flex.core.graphics.utils.PathHelper;
 
 	public class Path extends GraphicShape
@@ -52,16 +59,39 @@ package org.apache.flex.core.graphics
 		 */
 		public function drawPath(x:Number,y:Number,data:String):void
 		{
-			
-			graphics.clear();
-			applyStroke();
-			var bounds:Rectangle = PathHelper.getBounds(data);
-			this.width = bounds.width;
-			this.height = bounds.height;
-			beginFill(bounds,new Point(bounds.left + x, bounds.top + y) );
-			var graphicsPath:GraphicsPath = PathHelper.getSegments(data,x,y);
-			graphics.drawPath(graphicsPath.commands, graphicsPath.data);
-			endFill();
+			COMPILE::AS3
+            {
+                graphics.clear();
+                applyStroke();
+                var bounds:Rectangle = PathHelper.getBounds(data);
+                this.width = bounds.width;
+                this.height = bounds.height;
+                beginFill(bounds,new Point(bounds.left + x, bounds.top + y) );
+                var graphicsPath:GraphicsPath = PathHelper.getSegments(data,x,y);
+                graphics.drawPath(graphicsPath.commands, graphicsPath.data);
+                endFill();                    
+            }
+            COMPILE::JS
+            {
+                if (data == null || data.length === 0) return;
+                var style:String = getStyleStr();
+                var path:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'path') as WrappedHTMLElement;
+                path.flexjs_wrapper = this;
+                path.setAttribute('style', style);
+                path.setAttribute('d', data);
+                element.appendChild(path);
+                if (stroke)
+                {
+                    setPosition(x, y, stroke.weight, stroke.weight);
+                }
+                else
+                {
+                    setPosition(x, y, 0, 0);
+                }
+                
+                resize(x, y, path['getBBox']());
+
+            }
 		}
 		
 		override protected function draw():void

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Rect.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Rect.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Rect.as
index fd8d636..fd1daa8 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Rect.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/Rect.as
@@ -14,10 +14,17 @@
 
 package org.apache.flex.core.graphics
 {
-	import flash.display.CapsStyle;
-	import flash.display.JointStyle;
-	import flash.geom.Point;
-	import flash.geom.Rectangle;
+    COMPILE::AS3
+    {
+        import flash.display.CapsStyle;
+        import flash.display.JointStyle;
+        import flash.geom.Point;
+        import flash.geom.Rectangle;            
+    }
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;
+    }
 
 	public class Rect extends GraphicShape
 	{
@@ -33,14 +40,42 @@ package org.apache.flex.core.graphics
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
+         *  @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
 		 */
 		public function drawRect(x:Number, y:Number, width:Number, height:Number):void
 		{
-			graphics.clear();
-			applyStroke();
-			beginFill(new Rectangle(x, y, width, height), new Point(x,y));
-			graphics.drawRect(x, y, width, height);
-			endFill();
+            COMPILE::AS3
+            {
+                graphics.clear();
+                applyStroke();
+                beginFill(new Rectangle(x, y, width, height), new Point(x,y));
+                graphics.drawRect(x, y, width, height);
+                endFill();                    
+            }
+            COMPILE::JS
+            {
+                var style:String = this.getStyleStr();
+                var rect:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement;
+                rect.flexjs_wrapper = this;
+                rect.setAttribute('style', style);
+                if (stroke)
+                {
+                    rect.setAttribute('x', String(stroke.weight / 2) + 'px');
+                    rect.setAttribute('y', String(stroke.weight / 2) + 'px');
+                    setPosition(x, y, stroke.weight, stroke.weight);
+                }
+                else
+                {
+                    rect.setAttribute('x', '0' + 'px');
+                    rect.setAttribute('y', '0' + 'px');
+                    setPosition(x, y, 0, 0);
+                }
+                rect.setAttribute('width', String(width) + 'px');
+                rect.setAttribute('height', String(height) + 'px');
+                element.appendChild(rect);
+                
+                resize(x, y, rect['getBBox']());
+            }
 		}
 		
 		override protected function draw():void

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/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 bde4715..700c3bc 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
@@ -14,8 +14,11 @@
 
 package org.apache.flex.core.graphics
 {
-	import flash.geom.Point;
-	import flash.geom.Rectangle;
+    COMPILE::AS3
+    {
+        import flash.geom.Point;
+        import flash.geom.Rectangle;            
+    }
 
 	public class SolidColor implements IFill
 	{
@@ -78,14 +81,32 @@ package org.apache.flex.core.graphics
 			}
 		}
 		
+        COMPILE::AS3
 		public function begin(s:GraphicShape,targetBounds:Rectangle,targetOrigin:Point):void
 		{
 			s.graphics.beginFill(color,alpha);
 		}
 		
+        COMPILE::AS3
 		public function end(s:GraphicShape):void
 		{
 			s.graphics.endFill();
 		}
+        
+        /**
+         * addFillAttrib()
+         *
+         * @param value The GraphicShape object on which the fill must be added.
+         * @return {string}
+         */
+        COMPILE::JS
+        public function addFillAttrib(value:GraphicShape):String
+        {
+            var color:String = Number(color).toString(16);
+            if (color.length == 1) color = '00' + color;
+            if (color.length == 2) color = '00' + color;
+            if (color.length == 4) color = '00' + color;
+            return 'fill:#' + String(color) + ';fill-opacity:' + String(alpha);
+        }
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColorStroke.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColorStroke.as b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColorStroke.as
index b4b76b9..9535cdc 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColorStroke.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/SolidColorStroke.as
@@ -14,8 +14,11 @@
 
 package org.apache.flex.core.graphics
 {
-	import flash.display.CapsStyle;
-	import flash.display.JointStyle;
+    COMPILE::AS3
+    {
+        import flash.display.CapsStyle;
+        import flash.display.JointStyle;            
+    }
 
 	public class SolidColorStroke implements IStroke
 	{
@@ -100,10 +103,28 @@ package org.apache.flex.core.graphics
 			_weight = value;
 		}
 		
+        COMPILE::AS3
 		public function apply(s:GraphicShape):void
 		{
 			s.graphics.lineStyle(weight,color,alpha,false,"normal",CapsStyle.SQUARE,JointStyle.MITER);
 		}
 		
+        /**
+         * addStrokeAttrib()
+         * 
+         * @param value The GraphicShape object on which the stroke must be added.
+         * @return {string}
+         */
+        COMPILE::JS
+        public function addStrokeAttrib(value:GraphicShape):String
+        {
+            var strokeColor:String = Number(color).toString(16);
+            if (strokeColor.length == 1) strokeColor = '00' + strokeColor;
+            if (strokeColor.length == 2) strokeColor = '00' + strokeColor;
+            if (strokeColor.length == 4) strokeColor = '00' + strokeColor;
+            return 'stroke:#' + String(strokeColor) + ';stroke-width:' +
+                String(weight) + ';stroke-opacity:' + String(alpha);
+        };
+
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/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 d24427a..1773c1e 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
@@ -18,9 +18,15 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.core.graphics
 {
-	import flash.text.TextFieldType;
-	
-	import org.apache.flex.core.CSSTextField;
+    COMPILE::AS3
+    {
+        import flash.text.TextFieldType;        
+        import org.apache.flex.core.CSSTextField;            
+    }
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;
+    }
 	
 	/**
 	 *  Draws a string of characters at a specific location using the stroke
@@ -45,11 +51,15 @@ package org.apache.flex.core.graphics
 		{
 			super();
 			
-			_textField = new CSSTextField();
-			addChild(_textField);
+            COMPILE::AS3
+            {
+                _textField = new CSSTextField();
+                addChild(_textField);                    
+            }
 		}
 		
-		
+
+        COMPILE::AS3
 		private var _textField:CSSTextField;
 		
 		/**
@@ -60,6 +70,7 @@ package org.apache.flex.core.graphics
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
 		 */
+        COMPILE::AS3
 		public function get textField() : CSSTextField
 		{
 			return _textField;
@@ -75,23 +86,53 @@ package org.apache.flex.core.graphics
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
+         *  @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+         *  @flexjsignorecoercion Text
+         *  @flexjsignorecoercion Node
+         *  @flexjsignorecoercion SVGLocatable
 		 */
 		public function drawText(value:String, x:Number, y:Number):void
 		{
-			textField.selectable = false;
-			textField.type = TextFieldType.DYNAMIC;
-			textField.mouseEnabled = false;
-			textField.autoSize = "left";
-			textField.text = value;
-			
-			var color:SolidColorStroke = stroke as SolidColorStroke;
-			if (color) {
-				textField.textColor = color.color;
-				textField.alpha = color.alpha;
-			}
-			
-			textField.x = x;
-			textField.y = y;
+            COMPILE::AS3
+            {
+                textField.selectable = false;
+                textField.type = TextFieldType.DYNAMIC;
+                textField.mouseEnabled = false;
+                textField.autoSize = "left";
+                textField.text = value;
+                
+                var color:SolidColorStroke = stroke as SolidColorStroke;
+                if (color) {
+                    textField.textColor = color.color;
+                    textField.alpha = color.alpha;
+                }
+                
+                textField.x = x;
+                textField.y = y;                    
+            }
+            COMPILE::JS
+            {
+                var style:String = this.getStyleStr();
+                var text:WrappedHTMLElement = document.createElementNS('http://www.w3.org/2000/svg', 'text') as WrappedHTMLElement;
+                text.flexjs_wrapper = this;
+                text.setAttribute('style', style);
+                text.setAttribute('x', String(x) + 'px');
+                text.setAttribute('y', String(y) + 'px');
+                setPosition(x, y, 0, 0);
+                var textNode:Text = document.createTextNode(value) as Text;
+                text.appendChild(textNode as Node);
+                element.appendChild(text);
+                
+                resize(x, y, (text as SVGLocatable).getBBox());
+
+            }
 		}
+        
+        COMPILE::JS
+        override protected function draw():void
+        {
+            
+        }
+
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/build.xml b/frameworks/projects/Graphics/build.xml
index 07aa2db..6ebd7bd 100644
--- a/frameworks/projects/Graphics/build.xml
+++ b/frameworks/projects/Graphics/build.xml
@@ -37,7 +37,7 @@
     <target name="main" depends="clean,compile,test" description="Clean build of Graphics.swc">
     </target>
     
-    <target name="all" depends="main,compile-asjs,lint-js,test-js" description="Full build of Graphics.swc">
+    <target name="all" depends="clean,compile-asjs,compile-extern-swc,copy-js,compile,test" description="Full build of Graphics.swc">
     </target>
     
     <target name="test" unless="is.jenkins">
@@ -97,14 +97,72 @@
             <load-config filename="compile-config.xml" />
             <arg value="+playerglobal.version=${playerglobal.version}" />
             <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+            <arg value="-define=COMPILE::AS3,true" />
+            <arg value="-define=COMPILE::JS,false" />
         </compc>
     </target>
 
     <target name="compile-asjs" >
-        <!-- nothing to cross-compile yet -->
+        <echo message="Cross-compiling Graphics/asjs"/>
+        <echo message="FALCONJX_HOME: ${FALCONJX_HOME}"/>
+        <java jar="${FALCONJX_HOME}/lib/compc.jar" fork="true" >
+            <jvmarg value="-Xmx384m" />
+            <jvmarg value="-Dsun.io.useCanonCaches=false" />
+            <jvmarg value="-Dflexcompiler=${FALCONJX_HOME}/../compiler" />
+            <jvmarg value="-Dflexlib=${FLEXJS_HOME}/frameworks" />
+            <arg value="+flexlib=${FLEX_HOME}/frameworks" />
+            <arg value="-js-output-type=FLEXJS" />
+            <arg value="-keep-asdoc" /><!-- allows compiler to see @flexjsignorecoercion annotations -->
+            <arg value="-output=${basedir}/js/out" />
+            <arg value="-load-config=${basedir}/compile-asjs-config.xml" />
+            <arg value="+playerglobal.version=${playerglobal.version}" />
+            <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+            <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+            <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" />
+            <!-- this is not on external-library path otherwise goog.requires are not generated -->
+            <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" />
+            <arg value="-define=COMPILE::AS3,false" />
+            <arg value="-define=COMPILE::JS,true" />
+        </java>
     </target>
 
-    <target name="lint-js" depends="gjslint, jshint, copy-js" />
+    <target name="compile-extern-swc" description="Compiles .as files into .swc used for cross-compiling other projects">
+        <echo message="Compiling externs/Graphics.swc"/>
+        <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+        <echo message="FALCON_HOME: ${FALCON_HOME}"/>
+        <!-- make JS output folder now so include-file doesn't error -->
+        <mkdir dir="${FLEXJS_HOME}/frameworks/externs"/>
+        
+        <!-- Load the <compc> task. We can't do this at the <project> level -->
+        <!-- because targets that run before flexTasks.jar gets built would fail. -->
+        <taskdef resource="flexTasks.tasks" classpathref="lib.path"/>
+        <!--
+         Link in the classes (and their dependencies) for the MXML tags
+         listed in this project's manifest.xml.
+         Also link the additional classes (and their dependencies)
+         listed in CoreClasses.as,
+         because these aren't referenced by the manifest classes.
+         Keep the standard metadata when compiling.
+         Include the appropriate CSS files and assets in the SWC.
+         Don't include any resources in the SWC.
+         Write a bundle list of referenced resource bundles
+         into the file bundles.properties in this directory.
+         -->
+        <compc fork="true"
+            output="${FLEXJS_HOME}/frameworks/externs/Graphics.swc">
+            <jvmarg line="${compc.jvm.args}"/>
+            <load-config filename="compile-asjs-config.xml" />
+            <arg value="+playerglobal.version=${playerglobal.version}" />
+            <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+            <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" />
+            <!-- this is not on external-library path otherwise goog.requires are not generated -->
+            <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" />
+            <arg value="-define=COMPILE::AS3,false" />
+            <arg value="-define=COMPILE::JS,true" />
+        </compc>
+    </target>
+
+
     <target name="copy-js" >
         <copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs">
             <fileset dir="${basedir}/js/src">
@@ -113,30 +171,4 @@
         </copy>
     </target>
 
-    <target name="gjslint" unless="no.lint">
-        <echo>running gjslint</echo>
-        <exec executable="${gjslint}" dir="${basedir}" failonerror="true">
-            <arg value="--strict" />
-            <arg value="--disable" />
-            <arg value="006,100,214,300" />
-            <!-- 006: wrong indentation -->
-            <!-- 100: cannot have non-primitive value -->
-            <!-- 214: @fileoverview tag missing description -->
-            <!-- 300: missing newline at end of file -->
-            <arg value="--max_line_length" />
-            <arg value="120" />
-            <arg value="-r" />
-            <arg value="${basedir}/js/src" />
-        </exec>
-    </target>
-
-    <target name="jshint" unless="no.lint">
-        <echo>running jshint</echo>
-        <exec executable="${jshint}" dir="${basedir}" failonerror="true">
-            <arg value="--config" />
-            <arg value="${FLEX_HOME}/frameworks/js/jshint.properties" />
-            <arg value="${basedir}/js/src" />
-        </exec>
-    </target>
-
 </project>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/compile-asjs-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/compile-asjs-config.xml b/frameworks/projects/Graphics/compile-asjs-config.xml
new file mode 100644
index 0000000..4943b8e
--- /dev/null
+++ b/frameworks/projects/Graphics/compile-asjs-config.xml
@@ -0,0 +1,82 @@
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<flex-config>
+
+    <compiler>
+        <accessible>false</accessible>
+        
+        <external-library-path>
+        </external-library-path>
+        
+		<mxml>
+			<children-as-data>true</children-as-data>
+		</mxml>
+		<binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event>
+		<binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind>
+		<binding-value-change-event-type>valueChange</binding-value-change-event-type>
+
+        <keep-as3-metadata>
+          <name>Bindable</name>
+          <name>Managed</name>
+          <name>ChangeEvent</name>
+          <name>NonCommittingChangeEvent</name>
+          <name>Transient</name>
+        </keep-as3-metadata>
+	  
+        <locale/>
+        
+        <library-path>
+            <!-- asjscompc won't 'link' these classes in, but will list their requires
+                 if these swcs are on the external-library-path then their requires
+                 will not be listed -->
+            <path-element>../../externs/Core.swc</path-element>
+        </library-path>
+        
+        <namespaces>
+            <namespace>
+                <uri>library://ns.apache.org/flexjs/basic</uri>
+                <manifest>basic-manifest.xml</manifest>
+            </namespace>
+        </namespaces>
+        
+        <source-path>
+            <path-element>as/src</path-element>
+        </source-path>
+        
+        <warn-no-constructor>false</warn-no-constructor>
+    </compiler>
+    
+    <include-file>
+    </include-file>
+
+    <include-sources>
+    </include-sources>
+    
+    <include-classes>
+        <class>GraphicsClasses</class>
+    </include-classes>
+    
+    <include-namespaces>
+        <uri>library://ns.apache.org/flexjs/basic</uri>
+    </include-namespaces>
+        
+    <target-player>${playerglobal.version}</target-player>
+	
+
+</flex-config>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9cb1f75d/frameworks/projects/Graphics/compile-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/compile-config.xml b/frameworks/projects/Graphics/compile-config.xml
index eb660f2..200768a 100644
--- a/frameworks/projects/Graphics/compile-config.xml
+++ b/frameworks/projects/Graphics/compile-config.xml
@@ -60,8 +60,8 @@
     </compiler>
     
     <include-file>
-        <name>js/src/*</name>
-        <path>js/src/*</path>
+        <name>js/out/*</name>
+        <path>js/out/*</path>
     </include-file>
 
     <include-classes>


Mime
View raw message