Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript language elements > Global Functions > gotoAndPlay function | |||
gotoAndPlay([scene:String], frame:Object) : Void
Sends the playhead to the specified frame in a scene and plays from that frame. If no scene is specified, the playhead goes to the specified frame in the current scene. You can use the scene parameter only on the root Timeline, not within Timelines for movie clips or other objects in the document.
Availability: ActionScript 1.0; Flash Player 2
scene:String [optional] - A string specifying the name of the scene to which the playhead is sent.
frame:Object - A number representing the frame number, or a string representing the label of the frame, to which the playhead is sent.
In the following example, a document has two scenes: sceneOne and sceneTwo. Scene one contains a frame label on Frame 10 called newFrame and two buttons, myBtn_btn and myOtherBtn_btn. This ActionScript is placed on Frame 1, Scene 1 of the main Timeline.
stop();
myBtn_btn.onRelease = function(){
gotoAndPlay("newFrame");
};
myOtherBtn_btn.onRelease = function(){
gotoAndPlay("sceneTwo", 1);
};
When the user clicks the buttons, the playhead moves to the specified location and continues playing.
gotoAndPlay (MovieClip.gotoAndPlay method), nextFrame function, play function, prevFrame function
Version 8
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00001732.html
Comments
No screen name said on Sep 14, 2005 at 8:50 PM : No screen name said on Jun 29, 2007 at 2:00 AM : juankpro said on Aug 1, 2007 at 8:40 AM :