Continuing to use this current movie, lets look into the Projector Behavior
included in Flash MX 2004:
- Drag another copy of your rectangle Movie Clip from your Library to the Stage of your movie. Give it the instance name of zoomButton_mc.
- Scale the clip and move it into the upper-right corner of your movie.
- With the rectangle still selected, assign the Toggle Full Screen Mode Behavior.
- Since this Behavior doesn't have any parameters to change, it just displays a simple dialog. Click "OK" to proceed.

- Test your movie. You won't see any activity if you click the zoomButton_mc clip now, but if you close the test movie and open the SWF that was just created by the test movie (it should be in your working directory) you will be able to toggle the full-screen state of the projector.

That's it for the Projector Category of Behaviors. Next up, we're going to go through the Sound Behaviors. These Behaviors allow you to play audio that you may have in your movie's library or external MP3 files.
- Open the Flash document called behaviors_sound_01.fla located in your working directory. This file should have been included in the source files you downloaded at the beginning of this article.
I have placed a slew of buttons on the Stage and included one sound in the movie's Library, with its linkage properties set so its exported name is "clunk".

- Select the top most Play button on the left side of the Stage and assign the Load Sound from Library Behavior located in the Sound category of the Behaviors Panel.

- In the Load Sound from Library dialog box, fill in the linkage ID of the sound that is included in the Library, clunk. Give the sound a name so that other Behaviors can reference this sound later. The name cannot contain any spaces. This name is simply an identifier that the different Behaviors can use to control the sound.

- Now select the Stop button directly to the right of the Play button you have been dealing with. Assign the Stop All Sounds Behavior to the button. This Behavior has no parameters and it essentially stops any sound playing in the movie.
- Test your movie. You should hear a clunky sound play when you press the play button, and you should be able to stop it with the stop button.
- Now close your test movie and return to the Stage. Select the blue Play button on the left side of the Stage and assign it the Load Streaming MP3 File Behavior.
- The Load streaming MP3 file dialog box looks very similar to the Load Sound from library dialog box, but the first field requires the location of an MP3 file. Type in "test.mp3". That should be located in your working directory and was packaged with the source files you downloaded at the beginning of this article. For the reference name, enter testSound. Again, this reference name will be used by other sound Behaviors to control the sound.

- Select the blue stop button directly to the right of the play button that is playing the MP3 file. Assign the Stop Sound Behavior to the button. The Stop Sound Behavior stops the playing of a sound previously played by either the Load Streaming MP3 file Behavior or the Load from Library Behavior.

- In the Stop Sound dialog box, enter the reference name you gave the test.mp3 player earlier. This will allow the Stop button to control the MP3 player
- Test your movie. You should now be able to play both snippets of audio simultaneously. The purple stop button still stops all the sound, but the blue stop button only stops the test.mp3 file.
- Finally, for the last Behavior, close your test movie. Select the reload button on the in the cluster of button on the left of the Stage, and assign the

The Play Sound Behavior is an interesting one. It takes one parameter, that is the reference name of the sound you want to control.

- Test your movie. Click the play buttons and then click the upper right stop button to stop all currently playing sounds. Now click the reload button. You should hear the clunkSound audio playing again.
Those are all the Sound Behaviors that ship with Flash MX 2004. They
make it very easy to point and click your way to controlling library sounds
and streaming MP3 files.
|