You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ca...@apache.org on 2017/02/01 19:22:11 UTC
[11/13] git commit: [flex-asjs] [refs/heads/feature/mdl] - Sequence
now derived from CompundEffect
Sequence now derived from CompundEffect
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/cf38a5b9
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/cf38a5b9
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/cf38a5b9
Branch: refs/heads/feature/mdl
Commit: cf38a5b90aa494d5dcd4f2ac14fc5a418a45575b
Parents: a233be0
Author: yishayw <yi...@hotmail.com>
Authored: Tue Jan 31 10:32:38 2017 +0200
Committer: yishayw <yi...@hotmail.com>
Committed: Tue Jan 31 10:32:38 2017 +0200
----------------------------------------------------------------------
.../flex/org/apache/flex/effects/Sequence.as | 152 ++++---------------
.../flex/effects/beads/SequencePlayBead.as | 73 +++++++++
.../src/main/resources/basic-manifest.xml | 1 +
3 files changed, 102 insertions(+), 124 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cf38a5b9/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Sequence.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Sequence.as b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Sequence.as
index f6c3343..122105f 100644
--- a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Sequence.as
+++ b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/Sequence.as
@@ -19,134 +19,38 @@
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 Sequence effect animates a set of effects one
- * at a time.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
-public class Sequence extends Effect implements IDocument
-{
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function Sequence()
- {
- 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.SequencePlayBead;
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override public function set duration(value:Number):void
- {
- var n:int = children.length;
- for (var i:int = 0; i < 0; 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 Sequence effect animates set of effects one after the other.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
*/
- override public function play():void
+ public class Sequence extends CompoundEffect
{
- dispatchEvent(new Event(Effect.EFFECT_START));
- current = 0;
- playChildEffect();
+
+ //--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function Sequence()
+ {
+ super();
+ beads = [new SequencePlayBead()];
+ }
}
-
- private var current:int;
-
- private function playChildEffect():void
- {
- var child:IEffect = children[current];
- 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));
- else
- playChildEffect();
- }
-}
-
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cf38a5b9/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/beads/SequencePlayBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/beads/SequencePlayBead.as b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/beads/SequencePlayBead.as
new file mode 100644
index 0000000..755c0ca
--- /dev/null
+++ b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/beads/SequencePlayBead.as
@@ -0,0 +1,73 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.effects.beads
+{
+
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.effects.Effect;
+ import org.apache.flex.effects.ICompoundEffect;
+ import org.apache.flex.effects.IEffect;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ public class SequencePlayBead implements IBead
+ {
+ private var host:ICompoundEffect;
+
+ public function SequencePlayBead()
+ {
+ super();
+ }
+
+ public function set strand(value:IStrand):void
+ {
+ host = value as ICompoundEffect;
+ host.addEventListener('play', playHandler);
+ }
+
+ private function playHandler(e:Event):void
+ {
+ host.dispatchEvent(new Event(Effect.EFFECT_START));
+ current = 0;
+ playChildEffect();
+ }
+
+
+ private var current:int;
+
+ private function playChildEffect():void
+ {
+ var child:IEffect = host.getChildAt(current);
+ child.addEventListener(Effect.EFFECT_END, effectEndHandler);
+ child.play();
+ }
+
+ private function effectEndHandler(event:Event):void
+ {
+ (event.target as IEventDispatcher).removeEventListener(Effect.EFFECT_END, effectEndHandler);
+ current++;
+ if (current >= host.numChildren)
+ host.dispatchEvent(new Event(Effect.EFFECT_END));
+ else
+ playChildEffect();
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cf38a5b9/frameworks/projects/Effects/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Effects/src/main/resources/basic-manifest.xml b/frameworks/projects/Effects/src/main/resources/basic-manifest.xml
index 4bb39d2..5d7ba2a 100644
--- a/frameworks/projects/Effects/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Effects/src/main/resources/basic-manifest.xml
@@ -21,6 +21,7 @@
<componentPackage>
<component id="ParallelPlayBead" class="org.apache.flex.effects.beads.ParallelPlayBead"/>
+ <component id="SequencePlayBead" class="org.apache.flex.effects.beads.SequencePlayBead"/>
<component id="ParallelReverseBead" class="org.apache.flex.effects.beads.ParallelReverseBead"/>
<component id="Fade" class="org.apache.flex.effects.Fade"/>
<component id="Move" class="org.apache.flex.effects.Move"/>