Use A Behavior To Play An Mp3 File; Test Your Document; Summary - MACROMEDIA FLASH MX 2004-LEARNING FLASH Manual

Learning flash
Table of Contents

Advertisement

Use a behavior to play an MP3 file

When you want to add interactivity to your document with ActionScript, you can often rely on
behaviors to add the ActionScript for you. You'll use a sound behavior to play an MP3 file from
the library.
In the Library panel, right-click (Windows) or Control-click (Macintosh) ping.mp3 and select
1.
Linkage from the context menu.
In the Linkage Properties dialog box, select Export for ActionScript and verify that Export in
2.
First Frame is selected.
Verify that ping.mp3 appears in the Identifier text box, and click OK.
3.
On the Stage, select the playSound_btn instance.
4.
In the Behaviors panel (Window > Development Panels > Behaviors), click the Add (+) button
5.
and select Sound > Load Sound from Library.
In the linkage ID text box, enter ping.mp3, and in the Name text box below, enter ping. Then
6.
click OK.

Test your document

Test your document to verify that the interactivity works as expected.
Select Control > Test Movie.
1.
In the SWF file, click the left button to play Scene 2. When you finish viewing Scene 2, click
2.
the Back button.
Click the middle button in Scene 1 to see the movie clip play.
3.
Click the right button to play the MP3 sound.
4.
Click the left button again to verify that the movie clip unloads.
5.

Summary

Congratulations on learning how to create an interactive document. In a few minutes, you
learned how to accomplish the following tasks:
Create a new scene
Write ActionScript to navigate between scenes
Write ActionScript to play an animated movie clip at runtime
Use a behavior to play an MP3 file
To learn more about ActionScript, take another lesson in the Basic ActionScript series.
Summary
103

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents