Repository: flex-asjs
Updated Branches:
  refs/heads/develop ed7525180 -> 2ce0a9f6b


Add ParallelReverseBead


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

Branch: refs/heads/develop
Commit: 95d982bd964c70e9c8590046ba497850d1ed7935
Parents: ee4fa77
Author: yishayw <[email protected]>
Authored: Mon Jan 30 17:54:57 2017 +0200
Committer: yishayw <[email protected]>
Committed: Mon Jan 30 17:54:57 2017 +0200

----------------------------------------------------------------------
 .../flex/effects/beads/ParallelReverseBead.as   | 71 ++++++++++++++++++++
 .../src/main/resources/basic-manifest.xml       |  1 +
 2 files changed, 72 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95d982bd/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/beads/ParallelReverseBead.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/beads/ParallelReverseBead.as
 
b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/beads/ParallelReverseBead.as
new file mode 100644
index 0000000..505230e
--- /dev/null
+++ 
b/frameworks/projects/Effects/src/main/flex/org/apache/flex/effects/beads/ParallelReverseBead.as
@@ -0,0 +1,71 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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;
+       
+       public class ParallelReverseBead implements IBead
+       {
+               private var host:ICompoundEffect;
+               
+               public function ParallelReverseBead()
+               {
+                       super();
+               }
+               
+               public function set strand(value:IStrand):void
+               {
+                       host = value as ICompoundEffect;
+                       host.addEventListener('reverse', playHandler);
+               }
+               
+               private function playHandler(e:Event):void
+               {
+                       host.dispatchEvent(new Event(Effect.EFFECT_START));
+                       current = 0;
+                       var n:int = host.numChildren;
+                       for (var i:int = 0; i < n; i++)          
+                               playChildEffect(i);
+               }
+               
+               
+               private var current:int;
+               
+               private function playChildEffect(index:int):void
+               {
+                       var child:IEffect = host.getChildAt(index);
+                       child.addEventListener(Effect.EFFECT_END, 
effectEndHandler);
+                       child.reverse();   
+               }
+               
+               private function effectEndHandler(event:Event):void
+               {
+                       current++;
+                       if (current >= host.numChildren)
+                               host.dispatchEvent(new 
Event(Effect.EFFECT_END));
+               }
+               
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95d982bd/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 7d2d61b..4bb39d2 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="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"/>
     <component id="Resize" class="org.apache.flex.effects.Resize"/>

Reply via email to