MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 563

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

The following example uses the global
event handler to send the playhead of the timeline that contains the button to
onRelease
Frame 10:
jump_btn.onRelease = function () {
gotoAndPlay(10);
};
In the next example, the
clip instance named
categories_mc
methods
gotoAndPlay()
method applies.
jump_btn.onPress = function () {
categories_mc.gotoAndStop(10);
};
In the final example, the global
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);
}
Playing and stopping movie clips
Unless it is instructed otherwise, after a SWF file starts, it plays through every frame in the
timeline. You can start or stop a SWF file by using the
the equivalent MovieClip methods. For example, you can use
the end of a scene before proceeding to the next scene. After a SWF file stops, it must be
explicitly started again by calling
You can use the
play()
timeline or the timeline of any movie clip or loaded SWF file. The movie clip you want to
control must have an instance name and must be present in the timeline.
The following
on(press)
SWF file or movie clip that contains the button object:
// Attached to a button instance
on (press) {
// Plays the timeline that contains the button
play();
}
gotoAndPlay()
MovieClip.gotoAndStop()
to Frame 10 and stops. When you use the MovieClip
and
gotoAndStop(),
gotoAndStop()
or
play()
gotoAndPlay()
and
functions or MovieClip methods to control the main
stop()
handler attached to a button starts the playhead moving in the
function within a button object's
method sends the timeline of a movie
you must specify an instance to which the
function is used to move the playhead to
and
play()
stop()
stop()
.
Controlling SWF file playback
global functions or
to stop a SWF file at
563

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents