MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 103

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

Select Frame 1 in the main Timeline, and select Window > Development Panels > Actions. Add
7
the following code to the Actions panel:
speaker.stop();
song = new Sound();
song.onSoundComplete = function() {
speaker.stop();
};
song.attachSound("a_thousand_ways");
playButton.onRelease = function() {
song.start();
speaker.play();
};
stopButton.onRelease = function () {
song.stop();
speaker.stop();
}
This code first stops the speaker movie clip. It then creates a new Sound object (
attaches the sound whose linkage identifier is
onSoundComplete
sound has finished. Lastly,
objects start and stop the sound using the
stopButton
methods, and also play and stop the
Select Control > Test Movie to hear the sound.
8
To create a sliding volume control:
Drag a button to the Stage.
1
Select the button and select Modify > Convert to Symbol. Be careful to select the movie
2
clip behavior.
This creates a movie clip with the button on its first frame.
Select the movie clip and select Edit > Edit Selected.
3
Select the button and select Window > Development Panels > Actions.
4
Enter the following actions:
5
on (press) {
startDrag(this, false, left, top, right, bottom);
}
on (release) {
stopDrag();
}
The
startDrag()
Select Edit > Edit Document to return to the main Timeline.
6
Select the movie clip on the Stage.
7
handler for the song object, which stops the
handlers associated with the
onRelease
speaker
parameters
,
,
left
top
a_thousand_ways
Sound.start()
movie clip.
, and
are variables set in a clip action.
right
bottom
Creating interactivity and visual effects
) and
song
. Next, it defines an
movie clip once the
speaker
and
playButton
and
Sound.stop()
103

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?

Questions and answers

Table of Contents