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 2014/10/06 23:29:23 UTC

[04/17] git commit: [flex-asjs] [refs/heads/develop] - switch target to be string reference

switch target to be string reference


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

Branch: refs/heads/develop
Commit: 0473a17c2753ca44e281ac91e36b266e588364cb
Parents: bdcbc41
Author: Alex Harui <ah...@apache.org>
Authored: Mon Oct 6 13:07:14 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Oct 6 13:07:14 2014 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/effects/Fade.as         | 22 ++++++++------
 .../src/org/apache/flex/effects/Move.as         | 30 ++++++++++++--------
 .../src/org/apache/flex/effects/Resize.as       | 26 ++++++++++-------
 .../src/org/apache/flex/effects/Wipe.as         | 25 ++++++++++------
 4 files changed, 64 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0473a17c/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Fade.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Fade.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Fade.as
index ad3b821..28f0d16 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Fade.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Fade.as
@@ -43,7 +43,7 @@ public class Fade extends Tween implements IDocument
     /**
      *  Constructor.
      *
-     *  @param target Object ID or reference to an object that will
+     *  @param target An object that will
 	 *  have its x and/or y property animated.
      *
      *  @langversion 3.0
@@ -55,7 +55,7 @@ public class Fade extends Tween implements IDocument
     {
         super();
 
-		this.target = target;
+		this.actualTarget = target;
 		startValue = 0;
 		endValue = 1;
 		
@@ -78,7 +78,13 @@ public class Fade extends Tween implements IDocument
 	 *  @private
 	 *  The target.
 	 */
-	private var target:IUIBase;
+	private var actualTarget:IUIBase;
+    
+    /**
+     *  The target as the String id 
+     *  of a widget in an MXML Document.
+     */
+    public var target:String;
     
 	/**
 	 *  @private
@@ -127,11 +133,11 @@ public class Fade extends Tween implements IDocument
 	 */
 	override public function play():void
 	{
-		if (target is String)
-			target = document[target];
+        if (target != null)
+            actualTarget = document[target];
 		
 		if (isNaN(alphaFrom))
-			start = target.alpha;
+			start = actualTarget.alpha;
 		else
 			start = alphaFrom;
 		
@@ -146,13 +152,13 @@ public class Fade extends Tween implements IDocument
 	public function onTweenUpdate(value:Number):void
 	{
 		if (d)
-			target.alpha = start + value * d;
+			actualTarget.alpha = start + value * d;
 	}
 	
 	public function onTweenEnd(value:Number):void
 	{
 		if (d)
-			target.alpha = start + d;
+			actualTarget.alpha = start + d;
 	}
 }
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0473a17c/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Move.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Move.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Move.as
index d91b15e..2464be8 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Move.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Move.as
@@ -55,7 +55,7 @@ public class Move extends Tween implements IDocument
     {
         super();
 
-		this.target = target;
+		this.actualTarget = target;
 		startValue = 0;
 		endValue = 1;
 		
@@ -74,11 +74,17 @@ public class Move extends Tween implements IDocument
 	 */
 	private var document:Object;
 
+    /**
+     *  @private
+     *  The actual target.
+     */
+    private var actualTarget:IUIBase;
+    
 	/**
-	 *  @private
-	 *  The target.
+	 *  The target as the String id 
+     *  of a widget in an MXML Document.
 	 */
-	private var target:IUIBase;
+	public var target:String;
     
 	/**
 	 *  The change in x.
@@ -146,11 +152,11 @@ public class Move extends Tween implements IDocument
 	 */
 	override public function play():void
 	{
-		if (target is String)
-			target = document[target];
+		if (target != null)
+			actualTarget = document[target];
 		
 		if (isNaN(xFrom))
-			xStart = target.x;
+			xStart = actualTarget.x;
         if (isNaN(xBy))
         {
     		if (isNaN(xTo))
@@ -160,7 +166,7 @@ public class Move extends Tween implements IDocument
         }
         
 		if (isNaN(yFrom))
-			yStart = target.y;
+			yStart = actualTarget.y;
         if (isNaN(yBy))
         {
     		if (isNaN(yTo))
@@ -174,17 +180,17 @@ public class Move extends Tween implements IDocument
 	public function onTweenUpdate(value:Number):void
 	{
 		if (xBy)
-			target.x = xStart + value * xBy;
+			actualTarget.x = xStart + value * xBy;
 		if (yBy)
-			target.y = yStart + value * yBy;
+			actualTarget.y = yStart + value * yBy;
 	}
 	
 	public function onTweenEnd(value:Number):void
 	{
 		if (xBy)
-			target.x = xStart + xBy;
+			actualTarget.x = xStart + xBy;
 		if (yBy)
-			target.y = yStart + yBy;
+			actualTarget.y = yStart + yBy;
 	}
 }
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0473a17c/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as
index 298dc39..2ee1e15 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as
@@ -55,7 +55,7 @@ public class Resize extends Tween implements IDocument
     {
         super();
 
-		this.target = target;
+		this.actualTarget = target;
 		startValue = 0;
 		endValue = 1;
 		
@@ -78,7 +78,13 @@ public class Resize extends Tween implements IDocument
 	 *  @private
 	 *  The target.
 	 */
-	private var target:IUIBase;
+	private var actualTarget:IUIBase;
+    
+    /**
+     *  The target as the String id 
+     *  of a widget in an MXML Document.
+     */
+    public var target:String;
     
 	/**
 	 *  The change in width.
@@ -146,11 +152,11 @@ public class Resize extends Tween implements IDocument
 	 */
 	override public function play():void
 	{
-		if (target is String)
-			target = document[target];
+        if (target != null)
+            actualTarget = document[target];
 		
 		if (isNaN(widthFrom))
-			widthStart = target.width;
+			widthStart = actualTarget.width;
         if (isNaN(widthBy))
         {
     		if (isNaN(widthTo))
@@ -160,7 +166,7 @@ public class Resize extends Tween implements IDocument
         }
         
 		if (isNaN(heightFrom))
-			heightStart = target.height;
+			heightStart = actualTarget.height;
         if (isNaN(heightBy))
         {
     		if (isNaN(heightTo))
@@ -174,17 +180,17 @@ public class Resize extends Tween implements IDocument
 	public function onTweenUpdate(value:Number):void
 	{
 		if (widthBy)
-			target.width = widthStart + value * widthBy;
+			actualTarget.width = widthStart + value * widthBy;
 		if (heightBy)
-			target.height = heightStart + value * heightBy;
+			actualTarget.height = heightStart + value * heightBy;
 	}
 	
 	public function onTweenEnd(value:Number):void
 	{
 		if (widthBy)
-			target.width = widthStart + widthBy;
+			actualTarget.width = widthStart + widthBy;
 		if (heightBy)
-			target.height = heightStart + heightBy;
+			actualTarget.height = heightStart + heightBy;
 	}
 }
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0473a17c/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Wipe.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Wipe.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Wipe.as
index f1bb8ca..5b56883 100644
--- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Wipe.as
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Wipe.as
@@ -57,7 +57,7 @@ public class Wipe extends Tween implements IDocument
     {
         super();
 
-		this.target = target;
+		this.actualTarget = target;
         
 		listener = this;
     }
@@ -78,7 +78,13 @@ public class Wipe extends Tween implements IDocument
 	 *  @private
 	 *  The target.
 	 */
-	private var target:IUIBase;
+	private var actualTarget:IUIBase;
+    
+    /**
+     *  The target as the String id 
+     *  of a widget in an MXML Document.
+     */
+    public var target:String;
     
 	/**
 	 *  The direction of the Wipe.  "up" means the top will be the last
@@ -111,20 +117,21 @@ public class Wipe extends Tween implements IDocument
 	 */
 	override public function play():void
 	{
-		if (target is String)
-			target = document[target];
+        if (target != null)
+            actualTarget = document[target];
+        
 		
-        wiper.target = target;
+        wiper.target = actualTarget;
         if (direction == "up")
         {
-            startValue = target.height;
+            startValue = actualTarget.height;
             endValue = 0;
         }
         else
         {
             startValue = 0;
-            endValue = target.height;
-            wiper.visibleRect = new Rectangle(0, 0, target.width, 0);
+            endValue = actualTarget.height;
+            wiper.visibleRect = new Rectangle(0, 0, actualTarget.width, 0);
         }
         
 		super.play();
@@ -132,7 +139,7 @@ public class Wipe extends Tween implements IDocument
 
 	public function onTweenUpdate(value:Number):void
 	{
-		wiper.visibleRect = new Rectangle(0, 0, target.width, value);
+		wiper.visibleRect = new Rectangle(0, 0, actualTarget.width, value);
 	}
 	
 	public function onTweenEnd(value:Number):void