From: Yishay Weiss<mailto:yishayj...@hotmail.com> Sent: Tuesday, January 31, 2017 9:38 AM To: Piotr Zarzycki<mailto:piotrzarzyck...@gmail.com> Subject: RE: git commit: [flex-asjs] [refs/heads/develop] - Parallel is now derived from CompoundEffect
There are 2 stages: 1. Populate the beads array, which can be done in a derived class, or in the mxml. 2. Go over the beads array and call addBead() one after the other. This also sets the strand on each bead. If you up go to the Strand class you’ll see that there are 2 collections: beads:Array which is populated at the initialization stage (1), and _beads:Vector which holds the collection of beads that were actually added. Each strand implementation decides when stage (2) happens according to what makes sense. UIBase, for instance, does it when addedToParent() is called. In CompundEffect I do it as soon as the document is ready (setDocument()). Hope that explains it. From: Piotr Zarzycki<mailto:piotrzarzyck...@gmail.com> Sent: Tuesday, January 31, 2017 9:19 AM To: dev@flex.apache.org<mailto:dev@flex.apache.org> Subject: Re: git commit: [flex-asjs] [refs/heads/develop] - Parallel is now derived from CompoundEffect Hi Yishay, Maybe in that case would be better use addBead method instead create manually this array ? Piotr 2017-01-29 16:15 GMT+01:00 <yish...@apache.org>: > Repository: flex-asjs > Updated Branches: > refs/heads/develop 2cc5ca1a7 -> ee4fa779d > > > Parallel is now derived from CompoundEffect > > > Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo > Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ee4fa779 > Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ee4fa779 > Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ee4fa779 > > Branch: refs/heads/develop > Commit: ee4fa779d504e7e471a28b133a2a2ad94f5c9891 > Parents: 2cc5ca1 > Author: yishayw <yishayj...@hotmail.com> > Authored: Sun Jan 29 17:15:05 2017 +0200 > Committer: yishayw <yishayj...@hotmail.com> > Committed: Sun Jan 29 17:15:05 2017 +0200 > > ---------------------------------------------------------------------- > .../flex/org/apache/flex/effects/Parallel.as | 153 ++++--------------- > 1 file changed, 29 insertions(+), 124 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ > ee4fa779/frameworks/projects/Effects/src/main/flex/org/ > apache/flex/effects/Parallel.as > ---------------------------------------------------------------------- > diff --git > a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Parallel.as > b/frameworks/projects/Effects/src/main/flex/org/apache/flex/ > effects/Parallel.as > index ea68f2d..57e63d3 100644 > --- a/frameworks/projects/Effects/src/main/flex/org/apache/flex/ > effects/Parallel.as > +++ b/frameworks/projects/Effects/src/main/flex/org/apache/flex/ > effects/Parallel.as > @@ -19,134 +19,39 @@ > > package org.apache.flex.effects > { > - > -import org.apache.flex.core.IDocument; > -import org.apache.flex.core.IUIBase; > -import org.apache.flex.events.Event; > - > -[DefaultProperty("children")] > - > -/** > - * The Parallel effect animates set of effects at the > - * same time. > - * > - * @langversion 3.0 > - * @playerversion Flash 10.2 > - * @playerversion AIR 2.6 > - * @productversion FlexJS 0.0 > - */ > -public class Parallel extends Effect implements IDocument > -{ > - > - //---------------------------------------------------------- > ---------------- > - // > - // Constructor > - // > - //---------------------------------------------------------- > ---------------- > - > - /** > - * Constructor. > - * > - * @langversion 3.0 > - * @playerversion Flash 9 > - * @playerversion AIR 1.1 > - * @productversion Flex 3 > - */ > - public function Parallel() > - { > - super(); > - } > - > - //---------------------------------------------------------- > ---------------- > - // > - // Variables > - // > - //---------------------------------------------------------- > ---------------- > - > - /** > - * @private > - * The document. > - */ > - private var document:Object; > - > - /** > - * @private > - * The target. > - */ > - private var target:IUIBase; > - > - /** > - * The children. > - */ > - public var children:Array; > + import org.apache.flex.effects.beads.ParallelPlayBead; > > > - > - //---------------------------------------------------------- > ---------------- > - // > - // Properties > - // > - //---------------------------------------------------------- > ---------------- > - > - /** > - * @private > - */ > - override public function set duration(value:Number):void > - { > - var n:int = children ? children.length : 0; > - for (var i:int = 0; i < n; i++) > - { > - children[i].duration = value; > - } > - super.duration = value; > - } > - > - //---------------------------------------------------------- > ---------------- > - // > - // Methods > - // > - //---------------------------------------------------------- > ---------------- > - > - public function setDocument(document:Object, id:String = null):void > - { > - this.document = document; > - } > - > - public function addChild(child:IEffect):void > - { > - if (!children) > - children = [ child ]; > - else > - children.push(child); > - } > - > /** > - * @private > + * The Parallel effect animates set of effects at the > + * same time. > + * > + * @langversion 3.0 > + * @playerversion Flash 10.2 > + * @playerversion AIR 2.6 > + * @productversion FlexJS 0.0 > */ > - override public function play():void > + public class Parallel extends CompoundEffect > { > - dispatchEvent(new Event(Effect.EFFECT_START)); > - current = 0; > - var n:int = children.length; > - for (var i:int = 0; i < n; i++) > - playChildEffect(i); > + > + //---------------------------- > ---------------------------------------------- > + // > + // Constructor > + // > + //---------------------------- > ---------------------------------------------- > + > + /** > + * Constructor. > + * > + * @langversion 3.0 > + * @playerversion Flash 9 > + * @playerversion AIR 1.1 > + * @productversion Flex 3 > + */ > + public function Parallel() > + { > + super(); > + beads = [new ParallelPlayBead()]; > + } > } > - > - private var current:int; > - > - private function playChildEffect(index:int):void > - { > - var child:IEffect = children[index]; > - child.addEventListener(Effect.EFFECT_END, effectEndHandler); > - child.play(); > - } > - > - private function effectEndHandler(event:Event):void > - { > - current++; > - if (current >= children.length) > - dispatchEvent(new Event(Effect.EFFECT_END)); > - } > -} > - > } > > -- Greetings Piotr Zarzycki Flex/AIR/.NET Developer mobile: +48 880 859 557 e-mail: piotrzarzyck...@gmail.com skype: zarzycki10 LinkedIn: http://www.linkedin.com/piotrzarzycki <https://pl.linkedin.com/in/piotr-zarzycki-92a53552>