You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by gr...@apache.org on 2017/06/08 22:22:19 UTC

[1/4] git commit: [flex-asjs] [refs/heads/develop] - FLEX-35319 Fix for runaway tweens/tween timer in js

Repository: flex-asjs
Updated Branches:
  refs/heads/develop 90423a3ce -> 9e2267216


FLEX-35319 Fix for runaway tweens/tween timer in js


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

Branch: refs/heads/develop
Commit: b0f701368210a3bcf5eed40f8f2801f3fd73996b
Parents: 90423a3
Author: greg-dove <gr...@gmail.com>
Authored: Fri Jun 9 10:17:13 2017 +1200
Committer: greg-dove <gr...@gmail.com>
Committed: Fri Jun 9 10:17:13 2017 +1200

----------------------------------------------------------------------
 .../flex/org/apache/flex/utils/EffectTimer.as   |  75 ++--
 .../main/flex/org/apache/flex/effects/Tween.as  | 450 ++++++++++---------
 2 files changed, 269 insertions(+), 256 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b0f70136/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/EffectTimer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/EffectTimer.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/EffectTimer.as
index 505ae48..a648c14 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/EffectTimer.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/EffectTimer.as
@@ -40,7 +40,7 @@ import org.apache.flex.events.ValueEvent;
 /**
  *  Dispatched as requested via the delay and
  *  repeat count parameters in the constructor.
- *  
+ *
  *  @langversion 3.0
  *  @playerversion Flash 10.2
  *  @playerversion AIR 2.6
@@ -50,8 +50,8 @@ import org.apache.flex.events.ValueEvent;
 
 /**
  *  The Timer class dispatches events based on a delay
- *  and repeat count.  
- *  
+ *  and repeat count.
+ *
  *  @langversion 3.0
  *  @playerversion Flash 10.2
  *  @playerversion AIR 2.6
@@ -61,12 +61,12 @@ public class EffectTimer extends EventDispatcher implements IEffectTimer
 {
     /**
      *  Constructor.
-     * 
-     *  @param delay The number of milliseconds 
+     *
+     *  @param delay The number of milliseconds
      *  to wait before dispatching the event.
      *  @param repeatCount The number of times to dispatch
      *  the event.  If 0, keep dispatching forever.
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10.2
      *  @playerversion AIR 2.6
@@ -74,58 +74,61 @@ public class EffectTimer extends EventDispatcher implements IEffectTimer
      */
     public function EffectTimer()
     {
-		interval = ValuesManager.valuesImpl.getValue(this, "effectTimerInterval");
+        interval = ValuesManager.valuesImpl.getValue(this, "effectTimerInterval");
         COMPILE::SWF
         {
-    		timer = new flash.utils.Timer(interval);
-    		timer.addEventListener("timer", timerHandler);
+            timer = new flash.utils.Timer(interval);
+            timer.addEventListener("timer", timerHandler);
         }
     }
 
-    private var interval:int;
-    
+    private var interval:int=-1;
+
     COMPILE::SWF
-	private var timer:flash.utils.Timer;
-    
+    private var timer:flash.utils.Timer;
+
     COMPILE::JS
-    private var timerInterval:Number;
-	
-	public function start():int
-	{
+    private var timerInterval:Number = -1;
+
+    public function start():int
+    {
         COMPILE::SWF
         {
-    		timer.start();
-    		return getTimer();
+            timer.start();
+            return getTimer();
         }
         COMPILE::JS
         {
-            timerInterval =
-                setInterval(timerHandler, interval);
+            if (timerInterval == -1)  {
+                timerInterval = setInterval(timerHandler, interval);
+            }
             var d:Date = new Date();
             return d.getTime();
         }
-	}
-	
-	public function stop():void
-	{
+    }
+
+    public function stop():void
+    {
         COMPILE::SWF
         {
-    		timer.stop();
+            timer.stop();
         }
         COMPILE::JS
         {
-            clearInterval(timerInterval);
-            timerInterval = -1;
+            if (timerInterval != -1) {
+                clearInterval(timerInterval);
+                timerInterval = -1;
+            }
         }
-	}
-	
+    }
+
     COMPILE::SWF
-	private function timerHandler(event:flash.events.TimerEvent):void
-	{
-		event.updateAfterEvent();
-		dispatchEvent(new ValueEvent("update", false, false, getTimer()));
-	}
-    
+    private function timerHandler(event:flash.events.TimerEvent):void
+    {
+        event.updateAfterEvent();
+        dispatchEvent(new ValueEvent("update", false, false, getTimer()));
+    }
+
     COMPILE::JS
     private function timerHandler():void
     {

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b0f70136/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Tween.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Tween.as b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Tween.as
index 3b9415e..94664b8 100644
--- a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Tween.as
+++ b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Tween.as
@@ -28,7 +28,7 @@ import org.apache.flex.events.EventDispatcher;
 
 /**
  *  Tween is the underlying animation class for the effects in FlexJS.
- * 
+ *
  *  The Tween class defines a tween, a property animation performed
  *  on a target object over a period of time.
  *  That animation can be a change in position, such as performed by
@@ -37,10 +37,10 @@ import org.apache.flex.events.EventDispatcher;
  *  Dissolve effects; or other types of animations.
  *
  *  <p>A Tween instance accepts the <code>startValue</code>,
- *  <code>endValue</code>, and <code>duration</code> properties, 
- *  and an optional easing function to define the animation.</p> 
+ *  <code>endValue</code>, and <code>duration</code> properties,
+ *  and an optional easing function to define the animation.</p>
+ *
  *
- *  
  *  @langversion 3.0
  *  @playerversion Flash 10.2
  *  @playerversion AIR 2.6
@@ -48,105 +48,105 @@ import org.apache.flex.events.EventDispatcher;
  */
 public class Tween extends Effect
 {
-	//--------------------------------------------------------------------------
-	//
-	//  Class constants
-	//
-	//--------------------------------------------------------------------------
-	
-	/**
-	 *  The <code>Tween.TWEEN_END</code> constant defines the value of the 
-	 *  event object's <code>type</code> property for a <code>tweenEnd</code> event. 
-	 *
-	 *  <p>The properties of the event object have the following values:</p>
-	 *  <table class="innertable">
-	 *     <tr><th>Property</th><th>Value</th></tr>
-	 *     <tr><td><code>bubbles</code></td><td>false</td></tr>
-	 *     <tr><td><code>cancelable</code></td><td>false</td></tr>
-	 *     <tr><td><code>currentTarget</code></td><td>The Object that defines the 
-	 *       event listener that handles the event. For example, if you use 
-	 *       <code>myButton.addEventListener()</code> to register an event listener, 
-	 *       myButton is the value of the <code>currentTarget</code>. </td></tr>
-	 *     <tr><td><code>target</code></td><td>The Object that dispatched the event; 
-	 *       it is not always the Object listening for the event. 
-	 *       Use the <code>currentTarget</code> property to always access the 
-	 *       Object listening for the event.</td></tr>
-	 *     <tr><td><code>value</code></td><td>The value passed to the 
-	 *       <code>onTweenEnd()</code> method.</td></tr>
-	 *  </table>
-	 *
-	 *  @see org.apache.flex.effects.Effect
-	 *  @see org.apache.flex.effects.TweenEffect 
-	 *  @see org.apache.flex.events.EffectEvent
-	 *  @eventType tweenEnd 
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Flex 3
-	 */
-	public static const TWEEN_END:String = "tweenEnd";
-	
-	/**
-	 *  The <code>Tween.TWEEN_START</code> constant defines the value of the 
-	 *  event object's <code>type</code> property for a <code>tweenStart</code> event. 
-	 *
-	 *  <p>The properties of the event object have the following values:</p>
-	 *  <table class="innertable">
-	 *     <tr><th>Property</th><th>Value</th></tr>
-	 *     <tr><td><code>bubbles</code></td><td>false</td></tr>
-	 *     <tr><td><code>cancelable</code></td><td>false</td></tr>
-	 *     <tr><td><code>currentTarget</code></td><td>The Object that defines the 
-	 *       event listener that handles the event. For example, if you use 
-	 *       <code>myButton.addEventListener()</code> to register an event listener, 
-	 *       myButton is the value of the <code>currentTarget</code>. </td></tr>
-	 *     <tr><td><code>target</code></td><td>The Object that dispatched the event; 
-	 *       it is not always the Object listening for the event. 
-	 *       Use the <code>currentTarget</code> property to always access the 
-	 *       Object listening for the event.</td></tr>
-	 *     <tr><td><code>value</code></td><td>The value passed to the 
-	 *       <code>onTweenUpdate()</code> method.</td></tr>
-	 *  </table>
-	 *
-	 *  @eventType tweenStart
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Flex 3
-	 */
-	public static const TWEEN_START:String = "tweenStart";
-	
-	/**
-	 *  The <code>Tween.TWEEN_UPDATE</code> constant defines the value of the 
-	 *  event object's <code>type</code> property for a <code>tweenUpdate</code> event. 
-	 *
-	 *  <p>The properties of the event object have the following values:</p>
-	 *  <table class="innertable">
-	 *     <tr><th>Property</th><th>Value</th></tr>
-	 *     <tr><td><code>bubbles</code></td><td>false</td></tr>
-	 *     <tr><td><code>cancelable</code></td><td>false</td></tr>
-	 *     <tr><td><code>currentTarget</code></td><td>The Object that defines the 
-	 *       event listener that handles the event. For example, if you use 
-	 *       <code>myButton.addEventListener()</code> to register an event listener, 
-	 *       myButton is the value of the <code>currentTarget</code>. </td></tr>
-	 *     <tr><td><code>target</code></td><td>The Object that dispatched the event; 
-	 *       it is not always the Object listening for the event. 
-	 *       Use the <code>currentTarget</code> property to always access the 
-	 *       Object listening for the event.</td></tr>
-	 *     <tr><td><code>value</code></td><td>The value passed to the 
-	 *       <code>onTweenUpdate()</code> method.</td></tr>
-	 *  </table>
-	 *
-	 *  @eventType tweenUpdate
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Flex 3
-	 */
-	public static const TWEEN_UPDATE:String = "tweenUpdate";
-	
+    //--------------------------------------------------------------------------
+    //
+    //  Class constants
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  The <code>Tween.TWEEN_END</code> constant defines the value of the
+     *  event object's <code>type</code> property for a <code>tweenEnd</code> event.
+     *
+     *  <p>The properties of the event object have the following values:</p>
+     *  <table class="innertable">
+     *     <tr><th>Property</th><th>Value</th></tr>
+     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
+     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
+     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
+     *       event listener that handles the event. For example, if you use
+     *       <code>myButton.addEventListener()</code> to register an event listener,
+     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
+     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
+     *       it is not always the Object listening for the event.
+     *       Use the <code>currentTarget</code> property to always access the
+     *       Object listening for the event.</td></tr>
+     *     <tr><td><code>value</code></td><td>The value passed to the
+     *       <code>onTweenEnd()</code> method.</td></tr>
+     *  </table>
+     *
+     *  @see org.apache.flex.effects.Effect
+     *  @see org.apache.flex.effects.TweenEffect
+     *  @see org.apache.flex.events.EffectEvent
+     *  @eventType tweenEnd
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public static const TWEEN_END:String = "tweenEnd";
+
+    /**
+     *  The <code>Tween.TWEEN_START</code> constant defines the value of the
+     *  event object's <code>type</code> property for a <code>tweenStart</code> event.
+     *
+     *  <p>The properties of the event object have the following values:</p>
+     *  <table class="innertable">
+     *     <tr><th>Property</th><th>Value</th></tr>
+     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
+     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
+     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
+     *       event listener that handles the event. For example, if you use
+     *       <code>myButton.addEventListener()</code> to register an event listener,
+     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
+     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
+     *       it is not always the Object listening for the event.
+     *       Use the <code>currentTarget</code> property to always access the
+     *       Object listening for the event.</td></tr>
+     *     <tr><td><code>value</code></td><td>The value passed to the
+     *       <code>onTweenUpdate()</code> method.</td></tr>
+     *  </table>
+     *
+     *  @eventType tweenStart
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public static const TWEEN_START:String = "tweenStart";
+
+    /**
+     *  The <code>Tween.TWEEN_UPDATE</code> constant defines the value of the
+     *  event object's <code>type</code> property for a <code>tweenUpdate</code> event.
+     *
+     *  <p>The properties of the event object have the following values:</p>
+     *  <table class="innertable">
+     *     <tr><th>Property</th><th>Value</th></tr>
+     *     <tr><td><code>bubbles</code></td><td>false</td></tr>
+     *     <tr><td><code>cancelable</code></td><td>false</td></tr>
+     *     <tr><td><code>currentTarget</code></td><td>The Object that defines the
+     *       event listener that handles the event. For example, if you use
+     *       <code>myButton.addEventListener()</code> to register an event listener,
+     *       myButton is the value of the <code>currentTarget</code>. </td></tr>
+     *     <tr><td><code>target</code></td><td>The Object that dispatched the event;
+     *       it is not always the Object listening for the event.
+     *       Use the <code>currentTarget</code> property to always access the
+     *       Object listening for the event.</td></tr>
+     *     <tr><td><code>value</code></td><td>The value passed to the
+     *       <code>onTweenUpdate()</code> method.</td></tr>
+     *  </table>
+     *
+     *  @eventType tweenUpdate
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public static const TWEEN_UPDATE:String = "tweenUpdate";
+
 
     //--------------------------------------------------------------------------
     //
@@ -157,12 +157,14 @@ public class Tween extends Effect
     /**
      *  The list of tweens that are currently playing.
      */
-    public static var activeTweens:Object = {};
-    
-	private static var timer:IEffectTimer;
-	
-	private static var currentID:int = 1;
-        
+    public static var activeTweens:Object = { };
+
+    private static var activeCount:uint = 0;
+
+    private static var timer:IEffectTimer;
+
+    private static var currentID:uint = 1;
+
     //--------------------------------------------------------------------------
     //
     //  Class properties
@@ -177,7 +179,7 @@ public class Tween extends Effect
      *  Used by effects to get the current effect time tick.
      */
     public static var currentTime:Number = NaN;
-    
+
     //--------------------------------------------------------------------------
     //
     //  Class methods
@@ -189,17 +191,18 @@ public class Tween extends Effect
      */
     private static function addTween(tween:Tween):void
     {
-        tween.id = currentID++;
-        
-        activeTweens[tween.id] = tween;
-        
+        tween.uid = currentID++;
+
+        activeTweens[tween.uid] = tween;
+        activeCount++;
+
         if (!timer)
         {
             timer = ValuesManager.valuesImpl.newInstance(tween, "iEffectTimer") as IEffectTimer;
             timer.addEventListener("update", updateHandler);
-		}
+        }
         currentTime = timer.start();
-		
+
         tween.startTime = tween.previousUpdateTime = currentTime;
     }
 
@@ -209,26 +212,29 @@ public class Tween extends Effect
      */
     private static function removeTween(tween:Tween):void
     {
-		delete activeTweens[tween.id];
-		if (activeTweens.length == 0)
-			timer.stop();
+        delete activeTweens[tween.uid];
+        activeCount--;
+        if (activeCount === 0) {
+            timer.stop();
+        }
     }
 
     /**
+     *  @flexjsignorecoercion org.apache.flex.effects.Tween
      *  @private
      */
     private static function updateHandler(event:ValueEvent):void
     {
         var oldTime:Number = currentTime;
-		
-		// the IEFfectTimer can control the current time
-		// if it wants.  This can be useful for automated
-		// testing.
+
+        // the IEFfectTimer can control the current time
+        // if it wants.  This can be useful for automated
+        // testing.
         currentTime = event.value as Number;
 
-        for (var id:String in activeTweens)
+        for (var uid:String in activeTweens)
         {
-            var tween:Tween = Tween(activeTweens[id]);
+            var tween:Tween = Tween(activeTweens[uid]);
             tween.update();
         }
     }
@@ -248,7 +254,7 @@ public class Tween extends Effect
      *  @productversion Flex 3
      */
     public function Tween()
-    {        
+    {
     }
 
     //--------------------------------------------------------------------------
@@ -260,18 +266,18 @@ public class Tween extends Effect
     /**
      *  @private
      */
-    private var id:int = -1;
-    
+    private var uid:uint = 0;
+
     /**
      *  @private
      */
     private var _doSeek:Boolean = false;
-    
+
     /**
      *  @private
      */
     private var _isPlaying:Boolean = true;
-    
+
     /**
      *  @private
      */
@@ -281,52 +287,52 @@ public class Tween extends Effect
      *  @private
      */
     private var startTime:Number;
-    
+
     /**
      *  @private
      */
     private var previousUpdateTime:Number;
-    
+
     /**
      *  @private
      */
     private var userEquation:Function;
-        
+
     /**
      *  Final value of the animation.
      */
     public var endValue:Number;
-    
+
     /**
      *  Initial value of the animation.
      */
     public var startValue:Number;
-    
+
     /**
      *  @private
      */
     private var started:Boolean = false;
-    
+
     //--------------------------------------------------------------------------
     //
     //  Properties
     //
     //--------------------------------------------------------------------------
-    
+
     //----------------------------------
     //  listener
     //----------------------------------
 
     /**
-     *  Object that is notified at each interval of the animation. 
-     *  
+     *  Object that is notified at each interval of the animation.
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */
     public var listener:Object;
-    
+
     //----------------------------------
     //  playheadTime
     //----------------------------------
@@ -336,18 +342,18 @@ public class Tween extends Effect
      *  Storage for the playheadTime property.
      */
     private var _playheadTime:Number = 0;
-    
+
     /**
      *  @private
      *  The current millisecond position in the tween.
-     *  This value is between 0 and duration. 
+     *  This value is between 0 and duration.
      *  Use the seek() method to change the position of the tween.
      */
     private function get playheadTime():Number
     {
         return _playheadTime;
     }
-    
+
     //----------------------------------
     //  playReversed
     //----------------------------------
@@ -357,14 +363,14 @@ public class Tween extends Effect
      *  Storage for the playReversed property.
      */
     private var _invertValues:Boolean = false;
-    
+
     /**
      *  @private
      *  Starts playing reversed from start of tween.
      *  Setting this property to <code>true</code>
      *  inverts the values returned by the tween.
      *  Using reverse inverts the values and only plays
-     *  for as much time that has already elapsed. 
+     *  for as much time that has already elapsed.
      */
     private function get playReversed():Boolean
     {
@@ -372,13 +378,13 @@ public class Tween extends Effect
     }
 
     /**
-     *  @private 
+     *  @private
      */
     private function set playReversed(value:Boolean):void
     {
         _invertValues = value;
     }
-    
+
     //--------------------------------------------------------------------------
     //
     //  Methods
@@ -414,22 +420,22 @@ public class Tween extends Effect
      *  <p>Flex includes a set of easing functions
      *  in the mx.effects.easing package.</p>
      *
-     *  @param easingFunction Function that implements the easing equation. 
-     *  
+     *  @param easingFunction Function that implements the easing equation.
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
      */
     public function set easingFunction(value:Function):void
-    {   
+    {
         userEquation = value;
-    }   
-    
+    }
+
     /**
-     *  Interrupt the tween, jump immediately to the end of the tween, 
+     *  Interrupt the tween, jump immediately to the end of the tween,
      *  and invoke the <code>onTweenEnd()</code> callback function.
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
@@ -441,19 +447,20 @@ public class Tween extends Effect
         var value:Object = getCurrentValue(duration);
 
         event.value = value;
-        
+
         dispatchEvent(event);
-        
+
         listener.onTweenEnd(value);
 
         dispatchEvent(new Event(Effect.EFFECT_END));
-        
-        // If tween has been added, id >= 0
+        //reset
+        started = false;
+        // If tween has been added, id > 0
         // but if duration = 0, this might not be the case.
-        if (id >= 0) {
+        if (uid > 0) {
             Tween.removeTween(this);
-			id = -1;
-		}
+            uid = 0;
+        }
     }
 
     /**
@@ -463,7 +470,7 @@ public class Tween extends Effect
     protected function update():Boolean
     {
         var tweenEnded:Boolean = false;
-        
+
         // If user specified a minimum frames per second, we can't guarantee
         // that we'll be called often enough to satisfy that request.
         // However, we can avoid skipping over part of the animation.
@@ -471,21 +478,21 @@ public class Tween extends Effect
         // so that the animation starts up 'maxDelay' milliseconds
         // after its last update.
         /*
-        if (intervalTime - previousUpdateTime > maxDelay)
-        {
-            startTime += intervalTime - previousUpdateTime - maxDelay;
-        }
-        */
+         if (intervalTime - previousUpdateTime > maxDelay)
+         {
+         startTime += intervalTime - previousUpdateTime - maxDelay;
+         }
+         */
         previousUpdateTime = currentTime;
-        
+
         if (_isPlaying || _doSeek)
         {
-            
+
             var elapsedTime:Number = currentTime - startTime;
             _playheadTime = elapsedTime;
-            
+
             var currentValue:Object =
-                getCurrentValue(elapsedTime);
+                    getCurrentValue(elapsedTime);
 
             if (elapsedTime >= duration && !_doSeek)
             {
@@ -500,16 +507,16 @@ public class Tween extends Effect
                     dispatchEvent(startEvent);
                     started = true;
                 }
-            
+
                 var event:ValueEvent =
-                    new ValueEvent(Tween.TWEEN_UPDATE);
+                        new ValueEvent(Tween.TWEEN_UPDATE);
                 event.value = currentValue;
-                
+
                 dispatchEvent(event);
-                
+
                 listener.onTweenUpdate(currentValue);
             }
-            
+
             _doSeek = false;
         }
         return tweenEnded;
@@ -524,15 +531,15 @@ public class Tween extends Effect
         {
             return endValue;
         }
-    
+
         if (_invertValues)
             currentTime = duration - currentTime;
-    
+
         return userEquation(currentTime, startValue,
-                                endValue - startValue,
-                                duration);
+                endValue - startValue,
+                duration);
     }
-    
+
     /**
      *  @private
      */
@@ -541,40 +548,40 @@ public class Tween extends Effect
     {
         return c / 2 * (Math.sin(Math.PI * (t / d - 0.5)) + 1) + b;
     }
-    
+
     /**
-     *  Advances the tween effect to the specified position. 
+     *  Advances the tween effect to the specified position.
      *
      *  @param playheadTime The position, in milliseconds, between 0
      *  and the value of the <code>duration</code> property.
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
      *  @productversion Flex 3
-     */ 
+     */
     public function seek(playheadTime:Number):void
     {
         // Set value between 0 and duration
         //playheadTime = Math.min(Math.max(playheadTime, 0), duration);
-        
+
         var clockTime:Number = currentTime;
-        
+
         // Reset the previous update time
         previousUpdateTime = clockTime;
-        
+
         // Reset the start time
         startTime = clockTime - playheadTime;
-        
+
         _doSeek = true;
-        
+
         update();
     }
-    
+
     /**
      *  Plays the effect in reverse,
      *  starting from the current position of the effect.
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
@@ -593,10 +600,10 @@ public class Tween extends Effect
             _doReverse = !_doReverse;
         }
     }
-    
+
     /**
      *  Pauses the effect until you call the <code>resume()</code> method.
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
@@ -607,26 +614,28 @@ public class Tween extends Effect
         _isPlaying = false;
     }
 
-	/**
-	 *  Stops the tween, ending it without dispatching an event or calling
-	 *  the Tween's endFunction or <code>onTweenEnd()</code>. 
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Flex 3
-	 */
+    /**
+     *  Stops the tween, ending it without dispatching an event or calling
+     *  the Tween's endFunction or <code>onTweenEnd()</code>.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
     override public function play():void
-	{
-		if (userEquation == null)
-			userEquation = defaultEasingFunction;
-		Tween.addTween(this);
-	}
-	
+    {
+        if (uid == 0) {
+            if (userEquation == null)
+                userEquation = defaultEasingFunction;
+            Tween.addTween(this);
+        }
+    }
+
     /**
      *  Stops the tween, ending it without dispatching an event or calling
-     *  the Tween's endFunction or <code>onTweenEnd()</code>. 
-     *  
+     *  the Tween's endFunction or <code>onTweenEnd()</code>.
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
@@ -634,16 +643,17 @@ public class Tween extends Effect
      */
     override public function stop():void
     {
-        if (id >= 0) {
+        if (uid !== 0) {
             Tween.removeTween(this);
-			id = -1;
-		}
+            started = false;
+            uid = 0;
+        }
     }
-    
+
     /**
-     *  Resumes the effect after it has been paused 
-     *  by a call to the <code>pause()</code> method. 
-     *  
+     *  Resumes the effect after it has been paused
+     *  by a call to the <code>pause()</code> method.
+     *
      *  @langversion 3.0
      *  @playerversion Flash 9
      *  @playerversion AIR 1.1
@@ -652,14 +662,14 @@ public class Tween extends Effect
     override public function resume():void
     {
         _isPlaying = true;
-        
+
         startTime = currentTime - _playheadTime;
         if (_doReverse)
         {
             reverse();
             _doReverse = false;
         }
-    }   
+    }
 }
 
 }


Re: [2/4] git commit: [flex-asjs] [refs/heads/develop] - LayoutBase Fix for strand set to null in remove bead, plus performance improvements in js

Posted by Alex Harui <ah...@adobe.com.INVALID>.
I think there are two separate issues.  "Proxy and Wrappers" and "Content
Areas".

Panel and ScrollingViewports on certain platforms require "Content Areas",
a separate DOM widget that actually holds the children.  Right now we
override addElement and add a $addElement.  I think that's probably as
good as it can get.

My post below is about whether we can proxy which strand a bead gets added
to in a way that the bead doesn't get added to one strand and need removal
and adding to another strand.  It would be best if the bead only gets
added once to the right strand.

You are correct that we have to account for MXML bead declarations.  One
way is to require that someone not use the Panels's bead strand and have a
"childLayout" property instead.

<js:Panel>
     <js:childLayout>
	<js:HorizontalLayout />


Of course, I could be wrong...
-Alex

On 6/12/17, 6:25 AM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:

>Maybe I'm misunderstanding again.
>
><js:Panel>
>   <js:beads>
>      <js:HorizontalLayout />
>
>This is what a developer should do so that the contents of the panel are
>laid out horizontally.
>
>I constructed Panel as a subclass of Group so that I could take advantage
>of VerticalFlexLayout so that Container content area of the Panel would
>grow to fit the Panel's vertical space; any TitleBar or ControlBar would
>then remain fixed in size and place.
>
>But making Panel be a sub-class of Group meant that adding a layout
>in-line in MXML would cause that layout to supersede the Panel's
>VerticalFlexLayout. So Panel moves any layout bead supplied by the user
>and puts it onto its Container content area.
>
>Panel could have been constructed in another way and given the issues that
>we seem to be having with it, I suggest a re-write in version 0.9.0.
>
>Panel also suffers from having to re-parent any children given to it and
>place them into the Container (this happens for JS and SWF platforms).
>Container then re-parents those children, but only on the SWF platform, to
>its content view.
>
>‹peter
>
>On 6/9/17, 11:59 PM, "Alex Harui" <ah...@adobe.com.INVALID> wrote:
>
>>Yes, thanks for removing unnecessary coercions.
>>
>>While debugging examples, I also noted the removal of Layout in Panel.
>>Makes me wonder if we our container architecture/lifecycle is designed
>>properly.  The base classes may need to have a pattern for "proxies" and
>>"wrappers", which may be the essence of what Panels and Scrolling
>>Containers do (along with exposing instead of hiding the
>>addElement/removeElement APIs).
>>
>>Looking at the code for bead removal, it seems so heavy it makes you want
>>to avoid it all together.  For the password input bead, for example, we
>>know there can be a version of the bead with a flag to enable/disable the
>>password characters.  How heavy is that implementation vs the one that
>>requires removal?  For Panel, maybe the lifecycle should just not assume
>>that the Container has a layout bead so there isn't one to replace.
>>
>>Food for thought,
>>-Alex
>>
>>On 6/9/17, 4:00 PM, "Greg Dove" <gr...@gmail.com> wrote:
>>
>>>I happened to be testing against FlexJSStore at the time I discovered
>>>the
>>>need for this, and there is some removing going on.
>>>
>>>I think I improved performance compared to how it was originally by
>>>removing coercion in js and using local references for some of the
>>>repeat
>>>listener references/avoiding repeat closure lookups on js, so it is
>>>probably 'less' PAYG than it was before, with more safety, but I get the
>>>point.
>>>
>>>I'm not sure about injection, but I will come back to this and add a
>>>removable layout subclass for the FlexJSStore demo (not sure if the
>>>PanelView or whatever seems to be doing this is also used in other
>>>examples, I have not checked).
>>>
>>>
>>>
>>>
>>>On Sat, Jun 10, 2017 at 10:45 AM, Alex Harui <ah...@adobe.com> wrote:
>>>
>>>> I guess I don't believe that removing beads is so common that every
>>>>app
>>>> needs to carry this code around.  I wonder if there is a way to inject
>>>> removability as needed.
>>>>
>>>> Having a RemovableXXXLayout could override the strand setter and
>>>>remove
>>>> listeners if the handlers are protected.
>>>>
>>>> Thoughts?
>>>> -Alex
>>>>
>>>> On 6/8/17, 3:22 PM, "gregdove@apache.org" <gr...@apache.org> wrote:
>>>>
>>>> >LayoutBase Fix for strand set to null in remove bead, plus
>>>>performance
>>>> >improvements in js
>>>> >
>>>> >
>>>> >Project:
>>>> >https://na01.safelinks.protection.outlook.com/?url=
>>>> http%3A%2F%2Fgit-wip-us
>>>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Frepo&data=02%
>>>> 7C01%7C%7Cb863f5cff77
>>>> >e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
>>>> cee1%7C0%7C0%7C6363255
>>>> >73442866659&sdata=NsSQs6LJBQaYIJ36tZ%2FgMmMyuffAlo7pAuwtopOok2g%3D&
>>>> reserve
>>>> >d=0
>>>> >Commit:
>>>> >https://na01.safelinks.protection.outlook.com/?url=
>>>> http%3A%2F%2Fgit-wip-us
>>>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fcommit%
>>>> 2F08af60c7&data=02%7C01%7C%
>>>> >7Cb863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
>>>> cee1%7C0%
>>>> >7C0%7C636325573442866659&sdata=a8HJuqkEEii03BRyFH6lMcvkLFirlc
>>>> lo6HwG%2F6w4J
>>>> >kA%3D&reserved=0
>>>> >Tree:
>>>> >https://na01.safelinks.protection.outlook.com/?url=
>>>> http%3A%2F%2Fgit-wip-us
>>>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Ftree%2F08af60c7&
>>>> data=02%7C01%7C%7C
>>>> >b863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
>>>> cee1%7C0%7C
>>>> >0%7C636325573442866659&sdata=CcHeFSf6IMQ75kKXSE%
>>>> 2BWY23J7VrbJauoxO1TvG%2BHS
>>>> >Yk%3D&reserved=0
>>>> >Diff:
>>>> >https://na01.safelinks.protection.outlook.com/?url=
>>>> http%3A%2F%2Fgit-wip-us
>>>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fdiff%2F08af60c7&
>>>> data=02%7C01%7C%7C
>>>> >b863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
>>>> cee1%7C0%7C
>>>> >0%7C636325573442866659&sdata=E%2B6iEUFqZB3%2BO15%
>>>> 2BK3sHlnaiuIkWgm8DvWVcmUm
>>>> >nnIk%3D&reserved=0
>>>> >
>>>> >Branch: refs/heads/develop
>>>> >Commit: 08af60c7755a9c7dd64ab62cbfff97443841bda7
>>>> >Parents: b0f7013
>>>> >Author: greg-dove <gr...@gmail.com>
>>>> >Authored: Fri Jun 9 10:07:20 2017 +1200
>>>> >Committer: greg-dove <gr...@gmail.com>
>>>> >Committed: Fri Jun 9 10:17:54 2017 +1200
>>>> >
>>>> 
>>>>>----------------------------------------------------------------------
>>>> > .../flex/org/apache/flex/core/LayoutBase.as     | 40
>>>> +++++++++++++++-----
>>>> > 1 file changed, 30 insertions(+), 10 deletions(-)
>>>> 
>>>>>----------------------------------------------------------------------
>>>> >
>>>> >
>>>> >https://na01.safelinks.protection.outlook.com/?url=
>>>> http%3A%2F%2Fgit-wip-us
>>>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F08af60c7%
>>>> 2Fframeworks%2Fpro
>>>> >jects%2FBasic%2Fsrc%2Fmain%2Fflex%2Forg%2Fapache%2Fflex%
>>>> 2Fcore%2FLayoutBas
>>>> >e.as&data=02%7C01%7C%7Cb863f5cff77e41e305b708d4aebc
>>>> d62e%7Cfa7b1b5a7b344387
>>>> >94aed2c178decee1%7C0%7C0%7C636325573442866659&sdata=
>>>> fnKUKGhxZfwPRFkiMwfiri
>>>> >aNYV21HE8X7463sLtyYOo%3D&reserved=0
>>>> 
>>>>>----------------------------------------------------------------------
>>>> >diff --git
>>>> >a/frameworks/projects/Basic/src/main/flex/org/apache/flex/
>>>> core/LayoutBase.
>>>> >as
>>>> >b/frameworks/projects/Basic/src/main/flex/org/apache/flex/
>>>> core/LayoutBase.
>>>> >as
>>>> >index adadc75..be7d642 100644
>>>> >---
>>>> >a/frameworks/projects/Basic/src/main/flex/org/apache/flex/
>>>> core/LayoutBase.
>>>> >as
>>>> >+++
>>>> >b/frameworks/projects/Basic/src/main/flex/org/apache/flex/
>>>> core/LayoutBase.
>>>> >as
>>>> >@@ -76,19 +76,39 @@ package org.apache.flex.core
>>>> >          *  @productversion FlexJS 0.8
>>>> >                *
>>>> >                * @flexjsignorecoercion
>>>>org.apache.flex.core.ILayoutChild
>>>> >+               * @flexjsignorecoercion org.apache.flex.events.
>>>> IEventDispatcher
>>>> >          */
>>>> >               public function set strand(value:IStrand):void
>>>> >               {
>>>> >-            host = value as ILayoutChild;
>>>> >-
>>>> >-                      IEventDispatcher(host).addEventListener("
>>>> widthChanged",
>>>> >handleSizeChange);
>>>> >-                      IEventDispatcher(host).addEventListener("
>>>> heightChanged",
>>>> >handleSizeChange);
>>>> >-                      IEventDispatcher(host).
>>>> addEventListener("sizeChanged",
>>>> >handleSizeChange);
>>>> >-
>>>> >-                      IEventDispatcher(host).addEventListener("
>>>> childrenAdded",
>>>> >handleChildrenAdded);
>>>> >-                      IEventDispatcher(host).addEventListener("
>>>> initComplete",
>>>> >handleInitComplete);
>>>> >-
>>>> >-                      IEventDispatcher(host).addEventListener("
>>>> layoutNeeded",
>>>> >handleLayoutNeeded);
>>>> >+                      var newHost:ILayoutChild = value as
>>>>ILayoutChild;
>>>> >+                      var oldHost:ILayoutChild = host;
>>>> >+                      if (newHost != oldHost) {
>>>> >+                              var sizeChange:Function =
>>>>handleSizeChange;
>>>> >+                var childrenAdded:Function =handleChildrenAdded;
>>>> >+                              var initComplete:Function =
>>>> handleInitComplete;
>>>> >+                              var layoutNeeded:Function =
>>>> handleLayoutNeeded;
>>>> >+                if (oldHost) {
>>>> >+
>>>> >IEventDispatcher(oldHost).removeEventListener("widthChanged",
>>>> sizeChange);
>>>> >+
>>>> >IEventDispatcher(oldHost).removeEventListener("heightChanged",
>>>> >sizeChange);
>>>> >+
>>>> >IEventDispatcher(oldHost).removeEventListener("sizeChanged",
>>>>sizeChange);
>>>> >+
>>>> >+
>>>> >IEventDispatcher(oldHost).removeEventListener("childrenAdded",
>>>> >childrenAdded);
>>>> >+
>>>> >IEventDispatcher(oldHost).removeEventListener("initComplete",
>>>> >initComplete);
>>>> >+
>>>> >+
>>>> >IEventDispatcher(oldHost).removeEventListener("layoutNeeded",
>>>> >layoutNeeded);
>>>> >+                }
>>>> >+                              host = newHost;
>>>> >+                              if (newHost) {
>>>> >+
>>>> >IEventDispatcher(newHost).addEventListener("widthChanged",
>>>>sizeChange);
>>>> >+
>>>> >IEventDispatcher(newHost).addEventListener("heightChanged",
>>>>sizeChange);
>>>> >+
>>>> >IEventDispatcher(newHost).addEventListener("sizeChanged",
>>>>sizeChange);
>>>> >+
>>>> >+
>>>> >IEventDispatcher(newHost).addEventListener("childrenAdded",
>>>> >childrenAdded);
>>>> >+
>>>> >IEventDispatcher(newHost).addEventListener("initComplete",
>>>>initComplete);
>>>> >+
>>>> >+
>>>> >IEventDispatcher(newHost).addEventListener("layoutNeeded",
>>>>layoutNeeded);
>>>> >+                              }
>>>> >+                      }
>>>> >               }
>>>> >
>>>> >               /**
>>>> >
>>>>
>>>>
>>
>


Re: [2/4] git commit: [flex-asjs] [refs/heads/develop] - LayoutBase Fix for strand set to null in remove bead, plus performance improvements in js

Posted by Peter Ent <pe...@adobe.com.INVALID>.
Maybe I'm misunderstanding again.

<js:Panel>
   <js:beads>
      <js:HorizontalLayout />

This is what a developer should do so that the contents of the panel are
laid out horizontally.

I constructed Panel as a subclass of Group so that I could take advantage
of VerticalFlexLayout so that Container content area of the Panel would
grow to fit the Panel's vertical space; any TitleBar or ControlBar would
then remain fixed in size and place.

But making Panel be a sub-class of Group meant that adding a layout
in-line in MXML would cause that layout to supersede the Panel's
VerticalFlexLayout. So Panel moves any layout bead supplied by the user
and puts it onto its Container content area.

Panel could have been constructed in another way and given the issues that
we seem to be having with it, I suggest a re-write in version 0.9.0.

Panel also suffers from having to re-parent any children given to it and
place them into the Container (this happens for JS and SWF platforms).
Container then re-parents those children, but only on the SWF platform, to
its content view.

‹peter

On 6/9/17, 11:59 PM, "Alex Harui" <ah...@adobe.com.INVALID> wrote:

>Yes, thanks for removing unnecessary coercions.
>
>While debugging examples, I also noted the removal of Layout in Panel.
>Makes me wonder if we our container architecture/lifecycle is designed
>properly.  The base classes may need to have a pattern for "proxies" and
>"wrappers", which may be the essence of what Panels and Scrolling
>Containers do (along with exposing instead of hiding the
>addElement/removeElement APIs).
>
>Looking at the code for bead removal, it seems so heavy it makes you want
>to avoid it all together.  For the password input bead, for example, we
>know there can be a version of the bead with a flag to enable/disable the
>password characters.  How heavy is that implementation vs the one that
>requires removal?  For Panel, maybe the lifecycle should just not assume
>that the Container has a layout bead so there isn't one to replace.
>
>Food for thought,
>-Alex
>
>On 6/9/17, 4:00 PM, "Greg Dove" <gr...@gmail.com> wrote:
>
>>I happened to be testing against FlexJSStore at the time I discovered the
>>need for this, and there is some removing going on.
>>
>>I think I improved performance compared to how it was originally by
>>removing coercion in js and using local references for some of the repeat
>>listener references/avoiding repeat closure lookups on js, so it is
>>probably 'less' PAYG than it was before, with more safety, but I get the
>>point.
>>
>>I'm not sure about injection, but I will come back to this and add a
>>removable layout subclass for the FlexJSStore demo (not sure if the
>>PanelView or whatever seems to be doing this is also used in other
>>examples, I have not checked).
>>
>>
>>
>>
>>On Sat, Jun 10, 2017 at 10:45 AM, Alex Harui <ah...@adobe.com> wrote:
>>
>>> I guess I don't believe that removing beads is so common that every app
>>> needs to carry this code around.  I wonder if there is a way to inject
>>> removability as needed.
>>>
>>> Having a RemovableXXXLayout could override the strand setter and remove
>>> listeners if the handlers are protected.
>>>
>>> Thoughts?
>>> -Alex
>>>
>>> On 6/8/17, 3:22 PM, "gregdove@apache.org" <gr...@apache.org> wrote:
>>>
>>> >LayoutBase Fix for strand set to null in remove bead, plus performance
>>> >improvements in js
>>> >
>>> >
>>> >Project:
>>> >https://na01.safelinks.protection.outlook.com/?url=
>>> http%3A%2F%2Fgit-wip-us
>>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Frepo&data=02%
>>> 7C01%7C%7Cb863f5cff77
>>> >e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
>>> cee1%7C0%7C0%7C6363255
>>> >73442866659&sdata=NsSQs6LJBQaYIJ36tZ%2FgMmMyuffAlo7pAuwtopOok2g%3D&
>>> reserve
>>> >d=0
>>> >Commit:
>>> >https://na01.safelinks.protection.outlook.com/?url=
>>> http%3A%2F%2Fgit-wip-us
>>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fcommit%
>>> 2F08af60c7&data=02%7C01%7C%
>>> >7Cb863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
>>> cee1%7C0%
>>> >7C0%7C636325573442866659&sdata=a8HJuqkEEii03BRyFH6lMcvkLFirlc
>>> lo6HwG%2F6w4J
>>> >kA%3D&reserved=0
>>> >Tree:
>>> >https://na01.safelinks.protection.outlook.com/?url=
>>> http%3A%2F%2Fgit-wip-us
>>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Ftree%2F08af60c7&
>>> data=02%7C01%7C%7C
>>> >b863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
>>> cee1%7C0%7C
>>> >0%7C636325573442866659&sdata=CcHeFSf6IMQ75kKXSE%
>>> 2BWY23J7VrbJauoxO1TvG%2BHS
>>> >Yk%3D&reserved=0
>>> >Diff:
>>> >https://na01.safelinks.protection.outlook.com/?url=
>>> http%3A%2F%2Fgit-wip-us
>>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fdiff%2F08af60c7&
>>> data=02%7C01%7C%7C
>>> >b863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
>>> cee1%7C0%7C
>>> >0%7C636325573442866659&sdata=E%2B6iEUFqZB3%2BO15%
>>> 2BK3sHlnaiuIkWgm8DvWVcmUm
>>> >nnIk%3D&reserved=0
>>> >
>>> >Branch: refs/heads/develop
>>> >Commit: 08af60c7755a9c7dd64ab62cbfff97443841bda7
>>> >Parents: b0f7013
>>> >Author: greg-dove <gr...@gmail.com>
>>> >Authored: Fri Jun 9 10:07:20 2017 +1200
>>> >Committer: greg-dove <gr...@gmail.com>
>>> >Committed: Fri Jun 9 10:17:54 2017 +1200
>>> >
>>> >----------------------------------------------------------------------
>>> > .../flex/org/apache/flex/core/LayoutBase.as     | 40
>>> +++++++++++++++-----
>>> > 1 file changed, 30 insertions(+), 10 deletions(-)
>>> >----------------------------------------------------------------------
>>> >
>>> >
>>> >https://na01.safelinks.protection.outlook.com/?url=
>>> http%3A%2F%2Fgit-wip-us
>>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F08af60c7%
>>> 2Fframeworks%2Fpro
>>> >jects%2FBasic%2Fsrc%2Fmain%2Fflex%2Forg%2Fapache%2Fflex%
>>> 2Fcore%2FLayoutBas
>>> >e.as&data=02%7C01%7C%7Cb863f5cff77e41e305b708d4aebc
>>> d62e%7Cfa7b1b5a7b344387
>>> >94aed2c178decee1%7C0%7C0%7C636325573442866659&sdata=
>>> fnKUKGhxZfwPRFkiMwfiri
>>> >aNYV21HE8X7463sLtyYOo%3D&reserved=0
>>> >----------------------------------------------------------------------
>>> >diff --git
>>> >a/frameworks/projects/Basic/src/main/flex/org/apache/flex/
>>> core/LayoutBase.
>>> >as
>>> >b/frameworks/projects/Basic/src/main/flex/org/apache/flex/
>>> core/LayoutBase.
>>> >as
>>> >index adadc75..be7d642 100644
>>> >---
>>> >a/frameworks/projects/Basic/src/main/flex/org/apache/flex/
>>> core/LayoutBase.
>>> >as
>>> >+++
>>> >b/frameworks/projects/Basic/src/main/flex/org/apache/flex/
>>> core/LayoutBase.
>>> >as
>>> >@@ -76,19 +76,39 @@ package org.apache.flex.core
>>> >          *  @productversion FlexJS 0.8
>>> >                *
>>> >                * @flexjsignorecoercion
>>>org.apache.flex.core.ILayoutChild
>>> >+               * @flexjsignorecoercion org.apache.flex.events.
>>> IEventDispatcher
>>> >          */
>>> >               public function set strand(value:IStrand):void
>>> >               {
>>> >-            host = value as ILayoutChild;
>>> >-
>>> >-                      IEventDispatcher(host).addEventListener("
>>> widthChanged",
>>> >handleSizeChange);
>>> >-                      IEventDispatcher(host).addEventListener("
>>> heightChanged",
>>> >handleSizeChange);
>>> >-                      IEventDispatcher(host).
>>> addEventListener("sizeChanged",
>>> >handleSizeChange);
>>> >-
>>> >-                      IEventDispatcher(host).addEventListener("
>>> childrenAdded",
>>> >handleChildrenAdded);
>>> >-                      IEventDispatcher(host).addEventListener("
>>> initComplete",
>>> >handleInitComplete);
>>> >-
>>> >-                      IEventDispatcher(host).addEventListener("
>>> layoutNeeded",
>>> >handleLayoutNeeded);
>>> >+                      var newHost:ILayoutChild = value as
>>>ILayoutChild;
>>> >+                      var oldHost:ILayoutChild = host;
>>> >+                      if (newHost != oldHost) {
>>> >+                              var sizeChange:Function =
>>>handleSizeChange;
>>> >+                var childrenAdded:Function =handleChildrenAdded;
>>> >+                              var initComplete:Function =
>>> handleInitComplete;
>>> >+                              var layoutNeeded:Function =
>>> handleLayoutNeeded;
>>> >+                if (oldHost) {
>>> >+
>>> >IEventDispatcher(oldHost).removeEventListener("widthChanged",
>>> sizeChange);
>>> >+
>>> >IEventDispatcher(oldHost).removeEventListener("heightChanged",
>>> >sizeChange);
>>> >+
>>> >IEventDispatcher(oldHost).removeEventListener("sizeChanged",
>>>sizeChange);
>>> >+
>>> >+
>>> >IEventDispatcher(oldHost).removeEventListener("childrenAdded",
>>> >childrenAdded);
>>> >+
>>> >IEventDispatcher(oldHost).removeEventListener("initComplete",
>>> >initComplete);
>>> >+
>>> >+
>>> >IEventDispatcher(oldHost).removeEventListener("layoutNeeded",
>>> >layoutNeeded);
>>> >+                }
>>> >+                              host = newHost;
>>> >+                              if (newHost) {
>>> >+
>>> >IEventDispatcher(newHost).addEventListener("widthChanged",
>>>sizeChange);
>>> >+
>>> >IEventDispatcher(newHost).addEventListener("heightChanged",
>>>sizeChange);
>>> >+
>>> >IEventDispatcher(newHost).addEventListener("sizeChanged", sizeChange);
>>> >+
>>> >+
>>> >IEventDispatcher(newHost).addEventListener("childrenAdded",
>>> >childrenAdded);
>>> >+
>>> >IEventDispatcher(newHost).addEventListener("initComplete",
>>>initComplete);
>>> >+
>>> >+
>>> >IEventDispatcher(newHost).addEventListener("layoutNeeded",
>>>layoutNeeded);
>>> >+                              }
>>> >+                      }
>>> >               }
>>> >
>>> >               /**
>>> >
>>>
>>>
>


Re: [2/4] git commit: [flex-asjs] [refs/heads/develop] - LayoutBase Fix for strand set to null in remove bead, plus performance improvements in js

Posted by Alex Harui <ah...@adobe.com.INVALID>.
Yes, thanks for removing unnecessary coercions.

While debugging examples, I also noted the removal of Layout in Panel.
Makes me wonder if we our container architecture/lifecycle is designed
properly.  The base classes may need to have a pattern for "proxies" and
"wrappers", which may be the essence of what Panels and Scrolling
Containers do (along with exposing instead of hiding the
addElement/removeElement APIs).

Looking at the code for bead removal, it seems so heavy it makes you want
to avoid it all together.  For the password input bead, for example, we
know there can be a version of the bead with a flag to enable/disable the
password characters.  How heavy is that implementation vs the one that
requires removal?  For Panel, maybe the lifecycle should just not assume
that the Container has a layout bead so there isn't one to replace.

Food for thought,
-Alex

On 6/9/17, 4:00 PM, "Greg Dove" <gr...@gmail.com> wrote:

>I happened to be testing against FlexJSStore at the time I discovered the
>need for this, and there is some removing going on.
>
>I think I improved performance compared to how it was originally by
>removing coercion in js and using local references for some of the repeat
>listener references/avoiding repeat closure lookups on js, so it is
>probably 'less' PAYG than it was before, with more safety, but I get the
>point.
>
>I'm not sure about injection, but I will come back to this and add a
>removable layout subclass for the FlexJSStore demo (not sure if the
>PanelView or whatever seems to be doing this is also used in other
>examples, I have not checked).
>
>
>
>
>On Sat, Jun 10, 2017 at 10:45 AM, Alex Harui <ah...@adobe.com> wrote:
>
>> I guess I don't believe that removing beads is so common that every app
>> needs to carry this code around.  I wonder if there is a way to inject
>> removability as needed.
>>
>> Having a RemovableXXXLayout could override the strand setter and remove
>> listeners if the handlers are protected.
>>
>> Thoughts?
>> -Alex
>>
>> On 6/8/17, 3:22 PM, "gregdove@apache.org" <gr...@apache.org> wrote:
>>
>> >LayoutBase Fix for strand set to null in remove bead, plus performance
>> >improvements in js
>> >
>> >
>> >Project:
>> >https://na01.safelinks.protection.outlook.com/?url=
>> http%3A%2F%2Fgit-wip-us
>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Frepo&data=02%
>> 7C01%7C%7Cb863f5cff77
>> >e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
>> cee1%7C0%7C0%7C6363255
>> >73442866659&sdata=NsSQs6LJBQaYIJ36tZ%2FgMmMyuffAlo7pAuwtopOok2g%3D&
>> reserve
>> >d=0
>> >Commit:
>> >https://na01.safelinks.protection.outlook.com/?url=
>> http%3A%2F%2Fgit-wip-us
>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fcommit%
>> 2F08af60c7&data=02%7C01%7C%
>> >7Cb863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
>> cee1%7C0%
>> >7C0%7C636325573442866659&sdata=a8HJuqkEEii03BRyFH6lMcvkLFirlc
>> lo6HwG%2F6w4J
>> >kA%3D&reserved=0
>> >Tree:
>> >https://na01.safelinks.protection.outlook.com/?url=
>> http%3A%2F%2Fgit-wip-us
>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Ftree%2F08af60c7&
>> data=02%7C01%7C%7C
>> >b863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
>> cee1%7C0%7C
>> >0%7C636325573442866659&sdata=CcHeFSf6IMQ75kKXSE%
>> 2BWY23J7VrbJauoxO1TvG%2BHS
>> >Yk%3D&reserved=0
>> >Diff:
>> >https://na01.safelinks.protection.outlook.com/?url=
>> http%3A%2F%2Fgit-wip-us
>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fdiff%2F08af60c7&
>> data=02%7C01%7C%7C
>> >b863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
>> cee1%7C0%7C
>> >0%7C636325573442866659&sdata=E%2B6iEUFqZB3%2BO15%
>> 2BK3sHlnaiuIkWgm8DvWVcmUm
>> >nnIk%3D&reserved=0
>> >
>> >Branch: refs/heads/develop
>> >Commit: 08af60c7755a9c7dd64ab62cbfff97443841bda7
>> >Parents: b0f7013
>> >Author: greg-dove <gr...@gmail.com>
>> >Authored: Fri Jun 9 10:07:20 2017 +1200
>> >Committer: greg-dove <gr...@gmail.com>
>> >Committed: Fri Jun 9 10:17:54 2017 +1200
>> >
>> >----------------------------------------------------------------------
>> > .../flex/org/apache/flex/core/LayoutBase.as     | 40
>> +++++++++++++++-----
>> > 1 file changed, 30 insertions(+), 10 deletions(-)
>> >----------------------------------------------------------------------
>> >
>> >
>> >https://na01.safelinks.protection.outlook.com/?url=
>> http%3A%2F%2Fgit-wip-us
>> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F08af60c7%
>> 2Fframeworks%2Fpro
>> >jects%2FBasic%2Fsrc%2Fmain%2Fflex%2Forg%2Fapache%2Fflex%
>> 2Fcore%2FLayoutBas
>> >e.as&data=02%7C01%7C%7Cb863f5cff77e41e305b708d4aebc
>> d62e%7Cfa7b1b5a7b344387
>> >94aed2c178decee1%7C0%7C0%7C636325573442866659&sdata=
>> fnKUKGhxZfwPRFkiMwfiri
>> >aNYV21HE8X7463sLtyYOo%3D&reserved=0
>> >----------------------------------------------------------------------
>> >diff --git
>> >a/frameworks/projects/Basic/src/main/flex/org/apache/flex/
>> core/LayoutBase.
>> >as
>> >b/frameworks/projects/Basic/src/main/flex/org/apache/flex/
>> core/LayoutBase.
>> >as
>> >index adadc75..be7d642 100644
>> >---
>> >a/frameworks/projects/Basic/src/main/flex/org/apache/flex/
>> core/LayoutBase.
>> >as
>> >+++
>> >b/frameworks/projects/Basic/src/main/flex/org/apache/flex/
>> core/LayoutBase.
>> >as
>> >@@ -76,19 +76,39 @@ package org.apache.flex.core
>> >          *  @productversion FlexJS 0.8
>> >                *
>> >                * @flexjsignorecoercion
>>org.apache.flex.core.ILayoutChild
>> >+               * @flexjsignorecoercion org.apache.flex.events.
>> IEventDispatcher
>> >          */
>> >               public function set strand(value:IStrand):void
>> >               {
>> >-            host = value as ILayoutChild;
>> >-
>> >-                      IEventDispatcher(host).addEventListener("
>> widthChanged",
>> >handleSizeChange);
>> >-                      IEventDispatcher(host).addEventListener("
>> heightChanged",
>> >handleSizeChange);
>> >-                      IEventDispatcher(host).
>> addEventListener("sizeChanged",
>> >handleSizeChange);
>> >-
>> >-                      IEventDispatcher(host).addEventListener("
>> childrenAdded",
>> >handleChildrenAdded);
>> >-                      IEventDispatcher(host).addEventListener("
>> initComplete",
>> >handleInitComplete);
>> >-
>> >-                      IEventDispatcher(host).addEventListener("
>> layoutNeeded",
>> >handleLayoutNeeded);
>> >+                      var newHost:ILayoutChild = value as
>>ILayoutChild;
>> >+                      var oldHost:ILayoutChild = host;
>> >+                      if (newHost != oldHost) {
>> >+                              var sizeChange:Function =
>>handleSizeChange;
>> >+                var childrenAdded:Function =handleChildrenAdded;
>> >+                              var initComplete:Function =
>> handleInitComplete;
>> >+                              var layoutNeeded:Function =
>> handleLayoutNeeded;
>> >+                if (oldHost) {
>> >+
>> >IEventDispatcher(oldHost).removeEventListener("widthChanged",
>> sizeChange);
>> >+
>> >IEventDispatcher(oldHost).removeEventListener("heightChanged",
>> >sizeChange);
>> >+
>> >IEventDispatcher(oldHost).removeEventListener("sizeChanged",
>>sizeChange);
>> >+
>> >+
>> >IEventDispatcher(oldHost).removeEventListener("childrenAdded",
>> >childrenAdded);
>> >+
>> >IEventDispatcher(oldHost).removeEventListener("initComplete",
>> >initComplete);
>> >+
>> >+
>> >IEventDispatcher(oldHost).removeEventListener("layoutNeeded",
>> >layoutNeeded);
>> >+                }
>> >+                              host = newHost;
>> >+                              if (newHost) {
>> >+
>> >IEventDispatcher(newHost).addEventListener("widthChanged", sizeChange);
>> >+
>> >IEventDispatcher(newHost).addEventListener("heightChanged",
>>sizeChange);
>> >+
>> >IEventDispatcher(newHost).addEventListener("sizeChanged", sizeChange);
>> >+
>> >+
>> >IEventDispatcher(newHost).addEventListener("childrenAdded",
>> >childrenAdded);
>> >+
>> >IEventDispatcher(newHost).addEventListener("initComplete",
>>initComplete);
>> >+
>> >+
>> >IEventDispatcher(newHost).addEventListener("layoutNeeded",
>>layoutNeeded);
>> >+                              }
>> >+                      }
>> >               }
>> >
>> >               /**
>> >
>>
>>


Re: [2/4] git commit: [flex-asjs] [refs/heads/develop] - LayoutBase Fix for strand set to null in remove bead, plus performance improvements in js

Posted by Greg Dove <gr...@gmail.com>.
I happened to be testing against FlexJSStore at the time I discovered the
need for this, and there is some removing going on.

I think I improved performance compared to how it was originally by
removing coercion in js and using local references for some of the repeat
listener references/avoiding repeat closure lookups on js, so it is
probably 'less' PAYG than it was before, with more safety, but I get the
point.

I'm not sure about injection, but I will come back to this and add a
removable layout subclass for the FlexJSStore demo (not sure if the
PanelView or whatever seems to be doing this is also used in other
examples, I have not checked).




On Sat, Jun 10, 2017 at 10:45 AM, Alex Harui <ah...@adobe.com> wrote:

> I guess I don't believe that removing beads is so common that every app
> needs to carry this code around.  I wonder if there is a way to inject
> removability as needed.
>
> Having a RemovableXXXLayout could override the strand setter and remove
> listeners if the handlers are protected.
>
> Thoughts?
> -Alex
>
> On 6/8/17, 3:22 PM, "gregdove@apache.org" <gr...@apache.org> wrote:
>
> >LayoutBase Fix for strand set to null in remove bead, plus performance
> >improvements in js
> >
> >
> >Project:
> >https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Fgit-wip-us
> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Frepo&data=02%
> 7C01%7C%7Cb863f5cff77
> >e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C6363255
> >73442866659&sdata=NsSQs6LJBQaYIJ36tZ%2FgMmMyuffAlo7pAuwtopOok2g%3D&
> reserve
> >d=0
> >Commit:
> >https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Fgit-wip-us
> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fcommit%
> 2F08af60c7&data=02%7C01%7C%
> >7Cb863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%
> >7C0%7C636325573442866659&sdata=a8HJuqkEEii03BRyFH6lMcvkLFirlc
> lo6HwG%2F6w4J
> >kA%3D&reserved=0
> >Tree:
> >https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Fgit-wip-us
> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Ftree%2F08af60c7&
> data=02%7C01%7C%7C
> >b863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C
> >0%7C636325573442866659&sdata=CcHeFSf6IMQ75kKXSE%
> 2BWY23J7VrbJauoxO1TvG%2BHS
> >Yk%3D&reserved=0
> >Diff:
> >https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Fgit-wip-us
> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fdiff%2F08af60c7&
> data=02%7C01%7C%7C
> >b863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C
> >0%7C636325573442866659&sdata=E%2B6iEUFqZB3%2BO15%
> 2BK3sHlnaiuIkWgm8DvWVcmUm
> >nnIk%3D&reserved=0
> >
> >Branch: refs/heads/develop
> >Commit: 08af60c7755a9c7dd64ab62cbfff97443841bda7
> >Parents: b0f7013
> >Author: greg-dove <gr...@gmail.com>
> >Authored: Fri Jun 9 10:07:20 2017 +1200
> >Committer: greg-dove <gr...@gmail.com>
> >Committed: Fri Jun 9 10:17:54 2017 +1200
> >
> >----------------------------------------------------------------------
> > .../flex/org/apache/flex/core/LayoutBase.as     | 40
> +++++++++++++++-----
> > 1 file changed, 30 insertions(+), 10 deletions(-)
> >----------------------------------------------------------------------
> >
> >
> >https://na01.safelinks.protection.outlook.com/?url=
> http%3A%2F%2Fgit-wip-us
> >.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F08af60c7%
> 2Fframeworks%2Fpro
> >jects%2FBasic%2Fsrc%2Fmain%2Fflex%2Forg%2Fapache%2Fflex%
> 2Fcore%2FLayoutBas
> >e.as&data=02%7C01%7C%7Cb863f5cff77e41e305b708d4aebc
> d62e%7Cfa7b1b5a7b344387
> >94aed2c178decee1%7C0%7C0%7C636325573442866659&sdata=
> fnKUKGhxZfwPRFkiMwfiri
> >aNYV21HE8X7463sLtyYOo%3D&reserved=0
> >----------------------------------------------------------------------
> >diff --git
> >a/frameworks/projects/Basic/src/main/flex/org/apache/flex/
> core/LayoutBase.
> >as
> >b/frameworks/projects/Basic/src/main/flex/org/apache/flex/
> core/LayoutBase.
> >as
> >index adadc75..be7d642 100644
> >---
> >a/frameworks/projects/Basic/src/main/flex/org/apache/flex/
> core/LayoutBase.
> >as
> >+++
> >b/frameworks/projects/Basic/src/main/flex/org/apache/flex/
> core/LayoutBase.
> >as
> >@@ -76,19 +76,39 @@ package org.apache.flex.core
> >          *  @productversion FlexJS 0.8
> >                *
> >                * @flexjsignorecoercion org.apache.flex.core.ILayoutChild
> >+               * @flexjsignorecoercion org.apache.flex.events.
> IEventDispatcher
> >          */
> >               public function set strand(value:IStrand):void
> >               {
> >-            host = value as ILayoutChild;
> >-
> >-                      IEventDispatcher(host).addEventListener("
> widthChanged",
> >handleSizeChange);
> >-                      IEventDispatcher(host).addEventListener("
> heightChanged",
> >handleSizeChange);
> >-                      IEventDispatcher(host).
> addEventListener("sizeChanged",
> >handleSizeChange);
> >-
> >-                      IEventDispatcher(host).addEventListener("
> childrenAdded",
> >handleChildrenAdded);
> >-                      IEventDispatcher(host).addEventListener("
> initComplete",
> >handleInitComplete);
> >-
> >-                      IEventDispatcher(host).addEventListener("
> layoutNeeded",
> >handleLayoutNeeded);
> >+                      var newHost:ILayoutChild = value as ILayoutChild;
> >+                      var oldHost:ILayoutChild = host;
> >+                      if (newHost != oldHost) {
> >+                              var sizeChange:Function = handleSizeChange;
> >+                var childrenAdded:Function =handleChildrenAdded;
> >+                              var initComplete:Function =
> handleInitComplete;
> >+                              var layoutNeeded:Function =
> handleLayoutNeeded;
> >+                if (oldHost) {
> >+
> >IEventDispatcher(oldHost).removeEventListener("widthChanged",
> sizeChange);
> >+
> >IEventDispatcher(oldHost).removeEventListener("heightChanged",
> >sizeChange);
> >+
> >IEventDispatcher(oldHost).removeEventListener("sizeChanged", sizeChange);
> >+
> >+
> >IEventDispatcher(oldHost).removeEventListener("childrenAdded",
> >childrenAdded);
> >+
> >IEventDispatcher(oldHost).removeEventListener("initComplete",
> >initComplete);
> >+
> >+
> >IEventDispatcher(oldHost).removeEventListener("layoutNeeded",
> >layoutNeeded);
> >+                }
> >+                              host = newHost;
> >+                              if (newHost) {
> >+
> >IEventDispatcher(newHost).addEventListener("widthChanged", sizeChange);
> >+
> >IEventDispatcher(newHost).addEventListener("heightChanged", sizeChange);
> >+
> >IEventDispatcher(newHost).addEventListener("sizeChanged", sizeChange);
> >+
> >+
> >IEventDispatcher(newHost).addEventListener("childrenAdded",
> >childrenAdded);
> >+
> >IEventDispatcher(newHost).addEventListener("initComplete", initComplete);
> >+
> >+
> >IEventDispatcher(newHost).addEventListener("layoutNeeded", layoutNeeded);
> >+                              }
> >+                      }
> >               }
> >
> >               /**
> >
>
>

Re: [2/4] git commit: [flex-asjs] [refs/heads/develop] - LayoutBase Fix for strand set to null in remove bead, plus performance improvements in js

Posted by Alex Harui <ah...@adobe.com>.
I guess I don't believe that removing beads is so common that every app
needs to carry this code around.  I wonder if there is a way to inject
removability as needed.

Having a RemovableXXXLayout could override the strand setter and remove
listeners if the handlers are protected.

Thoughts?
-Alex

On 6/8/17, 3:22 PM, "gregdove@apache.org" <gr...@apache.org> wrote:

>LayoutBase Fix for strand set to null in remove bead, plus performance
>improvements in js
>
>
>Project: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Frepo&data=02%7C01%7C%7Cb863f5cff77
>e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6363255
>73442866659&sdata=NsSQs6LJBQaYIJ36tZ%2FgMmMyuffAlo7pAuwtopOok2g%3D&reserve
>d=0
>Commit: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fcommit%2F08af60c7&data=02%7C01%7C%
>7Cb863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%
>7C0%7C636325573442866659&sdata=a8HJuqkEEii03BRyFH6lMcvkLFirlclo6HwG%2F6w4J
>kA%3D&reserved=0
>Tree: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Ftree%2F08af60c7&data=02%7C01%7C%7C
>b863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C
>0%7C636325573442866659&sdata=CcHeFSf6IMQ75kKXSE%2BWY23J7VrbJauoxO1TvG%2BHS
>Yk%3D&reserved=0
>Diff: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fdiff%2F08af60c7&data=02%7C01%7C%7C
>b863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C
>0%7C636325573442866659&sdata=E%2B6iEUFqZB3%2BO15%2BK3sHlnaiuIkWgm8DvWVcmUm
>nnIk%3D&reserved=0
>
>Branch: refs/heads/develop
>Commit: 08af60c7755a9c7dd64ab62cbfff97443841bda7
>Parents: b0f7013
>Author: greg-dove <gr...@gmail.com>
>Authored: Fri Jun 9 10:07:20 2017 +1200
>Committer: greg-dove <gr...@gmail.com>
>Committed: Fri Jun 9 10:17:54 2017 +1200
>
>----------------------------------------------------------------------
> .../flex/org/apache/flex/core/LayoutBase.as     | 40 +++++++++++++++-----
> 1 file changed, 30 insertions(+), 10 deletions(-)
>----------------------------------------------------------------------
>
>
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F08af60c7%2Fframeworks%2Fpro
>jects%2FBasic%2Fsrc%2Fmain%2Fflex%2Forg%2Fapache%2Fflex%2Fcore%2FLayoutBas
>e.as&data=02%7C01%7C%7Cb863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b344387
>94aed2c178decee1%7C0%7C0%7C636325573442866659&sdata=fnKUKGhxZfwPRFkiMwfiri
>aNYV21HE8X7463sLtyYOo%3D&reserved=0
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.
>as 
>b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.
>as
>index adadc75..be7d642 100644
>--- 
>a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.
>as
>+++ 
>b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.
>as
>@@ -76,19 +76,39 @@ package org.apache.flex.core
>          *  @productversion FlexJS 0.8
> 		 * 
> 		 * @flexjsignorecoercion org.apache.flex.core.ILayoutChild
>+		 * @flexjsignorecoercion org.apache.flex.events.IEventDispatcher
>          */
> 		public function set strand(value:IStrand):void
> 		{
>-            host = value as ILayoutChild;
>-			
>-			IEventDispatcher(host).addEventListener("widthChanged",
>handleSizeChange);
>-			IEventDispatcher(host).addEventListener("heightChanged",
>handleSizeChange);
>-			IEventDispatcher(host).addEventListener("sizeChanged",
>handleSizeChange);
>-			
>-			IEventDispatcher(host).addEventListener("childrenAdded",
>handleChildrenAdded);
>-			IEventDispatcher(host).addEventListener("initComplete",
>handleInitComplete);
>-			
>-			IEventDispatcher(host).addEventListener("layoutNeeded",
>handleLayoutNeeded);
>+			var newHost:ILayoutChild = value as ILayoutChild;
>+			var oldHost:ILayoutChild = host;
>+			if (newHost != oldHost) {
>+				var sizeChange:Function = handleSizeChange;
>+                var childrenAdded:Function =handleChildrenAdded;
>+				var initComplete:Function = handleInitComplete;
>+				var layoutNeeded:Function = handleLayoutNeeded;
>+                if (oldHost) {
>+                 
>IEventDispatcher(oldHost).removeEventListener("widthChanged", sizeChange);
>+                 
>IEventDispatcher(oldHost).removeEventListener("heightChanged",
>sizeChange);
>+                 
>IEventDispatcher(oldHost).removeEventListener("sizeChanged", sizeChange);
>+
>+                 
>IEventDispatcher(oldHost).removeEventListener("childrenAdded",
>childrenAdded);
>+                 
>IEventDispatcher(oldHost).removeEventListener("initComplete",
>initComplete);
>+
>+                 
>IEventDispatcher(oldHost).removeEventListener("layoutNeeded",
>layoutNeeded);
>+                }
>+				host = newHost;
>+				if (newHost) {
>+                 
>IEventDispatcher(newHost).addEventListener("widthChanged", sizeChange);
>+                 
>IEventDispatcher(newHost).addEventListener("heightChanged", sizeChange);
>+                 
>IEventDispatcher(newHost).addEventListener("sizeChanged", sizeChange);
>+
>+                 
>IEventDispatcher(newHost).addEventListener("childrenAdded",
>childrenAdded);
>+                 
>IEventDispatcher(newHost).addEventListener("initComplete", initComplete);
>+
>+                 
>IEventDispatcher(newHost).addEventListener("layoutNeeded", layoutNeeded);
>+				}
>+			}
> 		}
> 		
> 		/**
>


Re: [2/4] git commit: [flex-asjs] [refs/heads/develop] - LayoutBase Fix for strand set to null in remove bead, plus performance improvements in js

Posted by Alex Harui <ah...@adobe.com.INVALID>.
I guess I don't believe that removing beads is so common that every app
needs to carry this code around.  I wonder if there is a way to inject
removability as needed.

Having a RemovableXXXLayout could override the strand setter and remove
listeners if the handlers are protected.

Thoughts?
-Alex

On 6/8/17, 3:22 PM, "gregdove@apache.org" <gr...@apache.org> wrote:

>LayoutBase Fix for strand set to null in remove bead, plus performance
>improvements in js
>
>
>Project: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Frepo&data=02%7C01%7C%7Cb863f5cff77
>e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6363255
>73442866659&sdata=NsSQs6LJBQaYIJ36tZ%2FgMmMyuffAlo7pAuwtopOok2g%3D&reserve
>d=0
>Commit: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fcommit%2F08af60c7&data=02%7C01%7C%
>7Cb863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%
>7C0%7C636325573442866659&sdata=a8HJuqkEEii03BRyFH6lMcvkLFirlclo6HwG%2F6w4J
>kA%3D&reserved=0
>Tree: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Ftree%2F08af60c7&data=02%7C01%7C%7C
>b863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C
>0%7C636325573442866659&sdata=CcHeFSf6IMQ75kKXSE%2BWY23J7VrbJauoxO1TvG%2BHS
>Yk%3D&reserved=0
>Diff: 
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fdiff%2F08af60c7&data=02%7C01%7C%7C
>b863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C
>0%7C636325573442866659&sdata=E%2B6iEUFqZB3%2BO15%2BK3sHlnaiuIkWgm8DvWVcmUm
>nnIk%3D&reserved=0
>
>Branch: refs/heads/develop
>Commit: 08af60c7755a9c7dd64ab62cbfff97443841bda7
>Parents: b0f7013
>Author: greg-dove <gr...@gmail.com>
>Authored: Fri Jun 9 10:07:20 2017 +1200
>Committer: greg-dove <gr...@gmail.com>
>Committed: Fri Jun 9 10:17:54 2017 +1200
>
>----------------------------------------------------------------------
> .../flex/org/apache/flex/core/LayoutBase.as     | 40 +++++++++++++++-----
> 1 file changed, 30 insertions(+), 10 deletions(-)
>----------------------------------------------------------------------
>
>
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-us
>.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F08af60c7%2Fframeworks%2Fpro
>jects%2FBasic%2Fsrc%2Fmain%2Fflex%2Forg%2Fapache%2Fflex%2Fcore%2FLayoutBas
>e.as&data=02%7C01%7C%7Cb863f5cff77e41e305b708d4aebcd62e%7Cfa7b1b5a7b344387
>94aed2c178decee1%7C0%7C0%7C636325573442866659&sdata=fnKUKGhxZfwPRFkiMwfiri
>aNYV21HE8X7463sLtyYOo%3D&reserved=0
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.
>as 
>b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.
>as
>index adadc75..be7d642 100644
>--- 
>a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.
>as
>+++ 
>b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.
>as
>@@ -76,19 +76,39 @@ package org.apache.flex.core
>          *  @productversion FlexJS 0.8
> 		 * 
> 		 * @flexjsignorecoercion org.apache.flex.core.ILayoutChild
>+		 * @flexjsignorecoercion org.apache.flex.events.IEventDispatcher
>          */
> 		public function set strand(value:IStrand):void
> 		{
>-            host = value as ILayoutChild;
>-			
>-			IEventDispatcher(host).addEventListener("widthChanged",
>handleSizeChange);
>-			IEventDispatcher(host).addEventListener("heightChanged",
>handleSizeChange);
>-			IEventDispatcher(host).addEventListener("sizeChanged",
>handleSizeChange);
>-			
>-			IEventDispatcher(host).addEventListener("childrenAdded",
>handleChildrenAdded);
>-			IEventDispatcher(host).addEventListener("initComplete",
>handleInitComplete);
>-			
>-			IEventDispatcher(host).addEventListener("layoutNeeded",
>handleLayoutNeeded);
>+			var newHost:ILayoutChild = value as ILayoutChild;
>+			var oldHost:ILayoutChild = host;
>+			if (newHost != oldHost) {
>+				var sizeChange:Function = handleSizeChange;
>+                var childrenAdded:Function =handleChildrenAdded;
>+				var initComplete:Function = handleInitComplete;
>+				var layoutNeeded:Function = handleLayoutNeeded;
>+                if (oldHost) {
>+                 
>IEventDispatcher(oldHost).removeEventListener("widthChanged", sizeChange);
>+                 
>IEventDispatcher(oldHost).removeEventListener("heightChanged",
>sizeChange);
>+                 
>IEventDispatcher(oldHost).removeEventListener("sizeChanged", sizeChange);
>+
>+                 
>IEventDispatcher(oldHost).removeEventListener("childrenAdded",
>childrenAdded);
>+                 
>IEventDispatcher(oldHost).removeEventListener("initComplete",
>initComplete);
>+
>+                 
>IEventDispatcher(oldHost).removeEventListener("layoutNeeded",
>layoutNeeded);
>+                }
>+				host = newHost;
>+				if (newHost) {
>+                 
>IEventDispatcher(newHost).addEventListener("widthChanged", sizeChange);
>+                 
>IEventDispatcher(newHost).addEventListener("heightChanged", sizeChange);
>+                 
>IEventDispatcher(newHost).addEventListener("sizeChanged", sizeChange);
>+
>+                 
>IEventDispatcher(newHost).addEventListener("childrenAdded",
>childrenAdded);
>+                 
>IEventDispatcher(newHost).addEventListener("initComplete", initComplete);
>+
>+                 
>IEventDispatcher(newHost).addEventListener("layoutNeeded", layoutNeeded);
>+				}
>+			}
> 		}
> 		
> 		/**
>


[2/4] git commit: [flex-asjs] [refs/heads/develop] - LayoutBase Fix for strand set to null in remove bead, plus performance improvements in js

Posted by gr...@apache.org.
LayoutBase Fix for strand set to null in remove bead, plus performance improvements in js


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

Branch: refs/heads/develop
Commit: 08af60c7755a9c7dd64ab62cbfff97443841bda7
Parents: b0f7013
Author: greg-dove <gr...@gmail.com>
Authored: Fri Jun 9 10:07:20 2017 +1200
Committer: greg-dove <gr...@gmail.com>
Committed: Fri Jun 9 10:17:54 2017 +1200

----------------------------------------------------------------------
 .../flex/org/apache/flex/core/LayoutBase.as     | 40 +++++++++++++++-----
 1 file changed, 30 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/08af60c7/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.as
index adadc75..be7d642 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.as
@@ -76,19 +76,39 @@ package org.apache.flex.core
          *  @productversion FlexJS 0.8
 		 * 
 		 * @flexjsignorecoercion org.apache.flex.core.ILayoutChild
+		 * @flexjsignorecoercion org.apache.flex.events.IEventDispatcher
          */
 		public function set strand(value:IStrand):void
 		{
-            host = value as ILayoutChild;
-			
-			IEventDispatcher(host).addEventListener("widthChanged", handleSizeChange);
-			IEventDispatcher(host).addEventListener("heightChanged", handleSizeChange);
-			IEventDispatcher(host).addEventListener("sizeChanged", handleSizeChange);
-			
-			IEventDispatcher(host).addEventListener("childrenAdded", handleChildrenAdded);
-			IEventDispatcher(host).addEventListener("initComplete", handleInitComplete);
-			
-			IEventDispatcher(host).addEventListener("layoutNeeded", handleLayoutNeeded);
+			var newHost:ILayoutChild = value as ILayoutChild;
+			var oldHost:ILayoutChild = host;
+			if (newHost != oldHost) {
+				var sizeChange:Function = handleSizeChange;
+                var childrenAdded:Function =handleChildrenAdded;
+				var initComplete:Function = handleInitComplete;
+				var layoutNeeded:Function = handleLayoutNeeded;
+                if (oldHost) {
+                    IEventDispatcher(oldHost).removeEventListener("widthChanged", sizeChange);
+                    IEventDispatcher(oldHost).removeEventListener("heightChanged", sizeChange);
+                    IEventDispatcher(oldHost).removeEventListener("sizeChanged", sizeChange);
+
+                    IEventDispatcher(oldHost).removeEventListener("childrenAdded", childrenAdded);
+                    IEventDispatcher(oldHost).removeEventListener("initComplete", initComplete);
+
+                    IEventDispatcher(oldHost).removeEventListener("layoutNeeded", layoutNeeded);
+                }
+				host = newHost;
+				if (newHost) {
+                    IEventDispatcher(newHost).addEventListener("widthChanged", sizeChange);
+                    IEventDispatcher(newHost).addEventListener("heightChanged", sizeChange);
+                    IEventDispatcher(newHost).addEventListener("sizeChanged", sizeChange);
+
+                    IEventDispatcher(newHost).addEventListener("childrenAdded", childrenAdded);
+                    IEventDispatcher(newHost).addEventListener("initComplete", initComplete);
+
+                    IEventDispatcher(newHost).addEventListener("layoutNeeded", layoutNeeded);
+				}
+			}
 		}
 		
 		/**


[4/4] git commit: [flex-asjs] [refs/heads/develop] - Improves for Wipe effect in js, to get tween replays working in FlexJSStore example

Posted by gr...@apache.org.
Improves for Wipe effect in js, to get tween replays working in FlexJSStore example


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

Branch: refs/heads/develop
Commit: 9e2267216d160ed3b56f092f7f73e008b8312b9a
Parents: 1af9cc8
Author: greg-dove <gr...@gmail.com>
Authored: Fri Jun 9 10:10:11 2017 +1200
Committer: greg-dove <gr...@gmail.com>
Committed: Fri Jun 9 10:18:54 2017 +1200

----------------------------------------------------------------------
 .../src/main/flex/org/apache/flex/effects/PlatformWiper.as  | 2 +-
 .../Effects/src/main/flex/org/apache/flex/effects/Wipe.as   | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9e226721/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/PlatformWiper.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/PlatformWiper.as b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/PlatformWiper.as
index 0e04f47..a9a1a3f 100644
--- a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/PlatformWiper.as
+++ b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/PlatformWiper.as
@@ -97,7 +97,7 @@ public class PlatformWiper
         }
         COMPILE::JS
         {
-            if (value == null) 
+            if (_target && value != _target)
             {
                 if (_overflow == null)
                     delete _target.positioner.style["overflow"];

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9e226721/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Wipe.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Wipe.as b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Wipe.as
index fe83935..bfd3f56 100644
--- a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Wipe.as
+++ b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Wipe.as
@@ -140,15 +140,20 @@ public class Wipe extends Tween implements IDocument
 
 	public function onTweenUpdate(value:Number):void
 	{
-        trace(actualTarget, value);
 		wiper.visibleRect = new Rectangle(0, 0, actualTarget.width, value);
 	}
 	
 	public function onTweenEnd(value:Number):void
 	{
         // WipeUp makes something disappear
-        if (direction == "up")
+        if (direction == "up") {
             actualTarget.visible = false;
+			COMPILE::JS {
+				//reset height in js
+                actualTarget.positioner.style.height = this.startValue+"px";
+			}
+		}
+
         wiper.target = null;
 	}
 }


[3/4] git commit: [flex-asjs] [refs/heads/develop] - Added guard to swf for getValue when requested field is not a member of the typed storage class

Posted by gr...@apache.org.
Added guard to swf for getValue when requested field is not a member of the typed storage class


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

Branch: refs/heads/develop
Commit: 1af9cc8f000f8059d178627cdd35e94d68a5892a
Parents: 08af60c
Author: greg-dove <gr...@gmail.com>
Authored: Fri Jun 9 10:09:17 2017 +1200
Committer: greg-dove <gr...@gmail.com>
Committed: Fri Jun 9 10:18:39 2017 +1200

----------------------------------------------------------------------
 .../flex/org/apache/flex/core/SimpleCSSValuesImpl.as  | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1af9cc8f/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as
index 5e3a6c4..b63db1a 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/SimpleCSSValuesImpl.as
@@ -339,7 +339,19 @@ package org.apache.flex.core
                 // undefined in JS null in AS
                 if (styleable.style != null)
                 {
-                    value = styleable.style[valueName];
+                    COMPILE::SWF
+                    {
+                        // guard to check for field avoiding need for try/catch
+                        if (valueName in styleable.style) {
+                            value = styleable.style[valueName];
+                        }
+                    }
+                    COMPILE::JS
+                    {
+                        //sets to undefined if not present
+                        value = styleable.style[valueName];
+                    }
+
                     if (value === INHERIT)
                         return getInheritingValue(thisObject, valueName, state, attrs);
                     if (value !== undefined)