Graphics Reference
In-Depth Information
5.5.2 Controlling the Timeline
You already learned simple methods for controlling the Timeline in chapter 4.
Here is a complete overview of the various actions and their function signatures.
The comments above a given action are automatically added by the Edge Ani-
mate snippets function to make the action clear.
You can use the actions stop() and play() to stop and play a Timeline.
Both actions can be called separately. If no argument is passed, the actions relate
to the current position of the playhead. In addition, you can pass an argument
for both actions. This argument can be either an integer or a string. For an inte-
ger, the value is interpreted in milliseconds and the playhead is moved to the
absolute position on the Timeline before stopping or playing. For a string, the
playhead jumps to the label. Make sure to use correct spelling for labels. If there
is no label, the action has no effect, and no error is reported.
// Stop and play Timeline
sym.stop();
sym.play();
// Timeline at the specified position
// stop (ms or name)
sym.stop(1000);
sym.stop("inal");
// Timeline from the specified position
// Play (ms or label)
sym.play (1000);
sym.play("intro");
You can also play a Timeline backward from the current position by using the
following action:
// Play in reverse
sym.playReverse();
The object reference sym is always a reference to any symbol. Instead of the
object reference sym, you can also use a reference to every symbol to control
its Timeline. Suppose you placed a symbol animation on the Stage called
MySymbol . You can play the symbol Timeline from the Stage (e.g. within a
click event) as follows:
// Play Timeline of a child symbol
sym.getSymbol("mySymbol").play();
 
Search WWH ::




Custom Search