April 5, 2001 - Maneuvering the Play Head in Flash | WebReference

April 5, 2001 - Maneuvering the Play Head in Flash

Yehuda Shiran April 5, 2001
Maneuvering the Play Head in Flash
Tips: April 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

The most popular method supported by the FlashSound JavaScript API (FJA) is TGotoAndPlay(). Use this method to direct the play head to a certain frame and to a certain command inside the frame:

TGotoAndPlay(frame, label)

The file interactivesound.swf includes the frame beamscan. In this frame there are both stop and start labels. To send the play head to the beginning of the playback, do:

mySoundObj.TGotoAndPlay("/beamscan", "start");

To stop the playback, send the playhead to the stop label:

mySoundObj.TGotoAndPlay("/beamscan", "stop");

The naming convention in Flash is similar to the unix directory structure. A top-level frame is written as a child of the parent timeline. That's why the frame name begins with a "/". The second parameter is a label name inside the frame: "start" or "stop". Notice that there is no command in Flash to start a playback or stop it. Instead, you direct the play head to a label that the author of the SWF file inserted.