Preedagrace's Blog

Just another WordPress.com weblog

Sequence

Posted by preedagrace on June 19, 2009

Sequence

The Sequence effect plays multiple child effects one after the other, in the order in which they are added.

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. Set properties, such as duration, on the individual effect objects.
  3. Create an instance of the Sequence effect object; for example:
    mySequenceEffect = new mx.effects.Sequence();
  4. Call the addChild() method for each of the effect objects; for example:
    mySequenceEffect.addChild(myFadeEffect);
  5. Invoke the Sequence effect’s play() method; for example:
    mySequenceEffect.play()

<?xml version=”1.0″ encoding=”utf-8″?>

<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml”>

<mx:Script>
<![CDATA[
import mx.effects.easing.*;
]]>
</mx:Script>

<mx:Sequence id=”movePauseMove”>
<mx:Move xBy=”150″ duration=”2000″ easingFunction=”Bounce.easeOut”/>
<mx:Pause duration=”2000″/>
<mx:Move xBy=”-150″ duration=”2000″ easingFunction=”Bounce.easeIn”/>
</mx:Sequence>

<mx:Panel title=”Sequence Effect Example” width=”75%” height=”75%”
paddingTop=”10″ paddingLeft=”10″ paddingRight=”10″ paddingBottom=”10″>

<mx:Text width=”100%” color=”blue”
text=”Click the phone image to start the Sequence effect. The effect pauses for 2 seconds between moves.”/>

<mx:Image
source=”@Embed(source=’assets/Nokia_6630.png’)”
mouseDownEffect=”{movePauseMove}”/>

</mx:Panel>
</mx:Application>

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>