Jumping to a frame or scene
To jump to a specific frame or scene in the SWF file, you can use the gotoAndPlay() and gotoAndStop() global functions or the equivalent MovieClip.gotoAndPlay() and MovieClip.gotoAndStop() methods of the MovieClip class. Each function or method lets you specify a frame to jump to in the current scene. If your document contains multiple scenes, you can specify a scene and frame where you want to jump.
The following example uses the global gotoAndPlay() function within a button object's onRelease event handler to send the playhead of the timeline that contains the button to Frame 10:
jump_btn.onRelease = function () {
gotoAndPlay(10);
};
In the next example, the MovieClip.gotoAndStop() method sends the timeline of a movie clip instance named categories_mc to Frame 10 and stops. When you use the MovieClip methods gotoAndPlay() and gotoAndStop(), you must specify an instance to which the method applies.
jump_btn.onPress = function () {
categories_mc.gotoAndStop(10);
};
In the final example, the global gotoAndStop() function is used to move the playhead to Frame 1 of Scene 2. 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.
nextScene_mc.onRelease = function() {
gotoAndStop("Scene 2", 1);
}