H  15  16.1  16.2  17  18  19  20  21  22  23 

Hands-On: Flash MX 2004 Working with Sound File

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.

  1. Re-open the testSharedSounds.fla file that you just installed Play and Stop buttons.
  2. Click the Stop button on the Stage.
  3. 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.
  4. .Properties Inspector for Sound Button

  5. Click the Window menu, point to Development Panels, and then click Behaviors (or [Shift] + [F3]) unless it’s already open.
  6. Click the Plus sign +, located in the upper-left portion of the Behaviors panel, point to Sound, and then click Stop Sound.
  7. Enter the name of the sound instance in the sound instance field.
  8. Stop Sound box.

  9. Click OK.
  10. Click the Control menu, and then click Test Movie to test the ActionScript, or use [Control] + [Enter].
  11. 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.

 

Back to Top