Exercise 18: Using ActionScript Behaviors with Stop Sound Files
Now that you added a PLAY button to your Flash MX 2004 file, you should learn
how to stop your sounds with ActionScript Behaviors.
Re-open the testSharedSounds.fla file that you just installed Play
and Stop buttons.
Click the Stop button on the Stage.
Enter a unique name in the instance field of the Properties panel.
I called mine comfort for the comfortable.wav file I’m using,
and it’s the same name I chose for the Play button, that way I won’t
be confused when I’m calling up the instance names in the Behaviors.
.
Click the Window menu, point to Development Panels, and then
click Behaviors (or [Shift] + [F3]) unless it’s already
open.
Click the Plus sign +, located in the upper-left portion of
the Behaviors panel, point to Sound, and then click Stop Sound.
Enter the name of the sound instance in the sound instance
field.
Click OK.
Click the Control menu, and then click Test Movie to test
the ActionScript, or use [Control] + [Enter].
Your button will stop the sound file when pressed.
Even I have to admit, although there are many new steps in this version of
Flash MX 2004, it really wasn’t that hard to create these Play and Stopbuttons after
all. Do it a few times and you’ll be OK.