//////////////////////////////////////////////////////////////////////////////// // // 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 mx.effects { import mx.effects.effectClasses.SequenceInstance; /** * The Sequence effect plays multiple child effects one after the other, * in the order in which they are added. * *

You can create a Sequence effect in MXML, * as the following example shows:

* *
 *  <mx:Sequence id="WipeRightUp">
 *    <mx:children>
 *      <mx:WipeRight duration="1000"/>
 *      <mx:WipeUp duration="1000"/>
 *    </mx:children>
 *  </mx:Sequence>
 *  
 *  <mx:VBox id="myBox" hideEffect="{WipeRightUp}">
 *    <mx:TextArea id="aTextArea" text="hello"/>
 *  </mx:VBox>
 *  
* *

Notice that the <mx:children> tag is optional.

* *

Starting a composite effect in ActionScript is usually * a five-step process:

* *
    *
  1. Create instances of the effect objects to be composited together; * for example: *
    myFadeEffect = new mx.effects.Fade(target);
  2. *
  3. Set properties, such as duration, on the individual effect objects.
  4. *
  5. Create an instance of the Sequence effect object; * for example: *
    mySequenceEffect = new mx.effects.Sequence();
  6. *
  7. Call the addChild() method for each of the effect objects; * for example: *
    mySequenceEffect.addChild(myFadeEffect);
  8. *
  9. Invoke the Sequence effect's play() method; * for example: *
    mySequenceEffect.play();
  10. *
* * @mxml * *

The <mx:Sequence> tag * inherits all of the tag attributes of its superclass, * and adds the following tag attributes:

* *
 *  <mx:Sequence id="identifier">
 *    <mx:children>
 *      <!-- Specify child effect tags --> 
 *    </mx:children>
 *  </mx:Sequence>
 *  
* * @see mx.effects.effectClasses.SequenceInstance * * @includeExample examples/SequenceEffectExample.mxml * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public class Sequence extends CompositeEffect { include "../core/Version.as"; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. * * @param target This argument is ignored for Sequence effects. * It is included only for consistency with other types of effects. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ public function Sequence(target:Object = null) { super(target); instanceClass = SequenceInstance; } //-------------------------------------------------------------------------- // // Overridden methods // //-------------------------------------------------------------------------- /** * @private */ override protected function initInstance(instance:IEffectInstance):void { super.initInstance(instance); } /** * @inheritDoc * * Sequence calculates this number to be the duration of each * child effect, played one after the other. * * @langversion 3.0 * @playerversion Flash 9 * @playerversion AIR 1.1 * @productversion Flex 3 */ override public function get compositeDuration():Number { var sequenceDuration:Number = 0; for (var i:int = 0; i < children.length; ++i) { var childDuration:Number; var child:Effect = Effect(children[i]); if (child is CompositeEffect) childDuration = CompositeEffect(child).compositeDuration; else childDuration = child.duration; childDuration = childDuration * child.repeatCount + (child.repeatDelay * (child.repeatCount - 1)) + child.startDelay; sequenceDuration += childDuration; } return sequenceDuration; } } }