• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 8. Controlling Sound > Managing Sounds as External Files

Managing Sounds as External Files

Each time you use the Symbol Linkage Properties dialog box to identify a sound in the Library and mark it for export, that sound is added to your SWF, increasing its size. Sounds take up an enormous amount of space, even with MP3 compression, so you have to be judicious with your inclusion of sounds. One way to manage sounds so that your file size stays small is to keep sounds in external Flash movies. Use the action loadMovieNum to bring sounds into Flash only when you need them. This also allows you to change the sound in the external Flash movie easily without tinkering with the main Flash movie. For example, you can maintain several background music tracks that users can choose from. To turn the music on, you use the action loadMovieNum, and to turn the music off, you use the action unloadMovieNum. You could even have one external SWF trigger the loading of another external SWF or trigger the loading of a randomly selected SWF. This would add variety by playing a random medley from a collection of external music files.

To play a sound in an external movie:

Import a sound into Flash.

Place an instance of the sound on the Timeline. From the Sound panel, select the Stream Sync option, and add frames to the Timeline to accommodate the entire sound (Figure 8.40).

Figure 8.40. A sound set to the Stream Sync option is tied to individual frames of the Timeline.

Export the file as a SWF.

Open a new Flash file.

Create a button symbol, and place an instance of it on the Stage.

Select the button, and open the Actions panel.

Choose Actions > loadMovie (Esc + lm).

In the URL field of the Actions panel, enter the name of your exported SWF file. In the Location pull-down menu, select Level, and enter a number higher than 0 (Figure 8.41).

Figure 8.41. These actions assigned to the button load the file music.swf.

Export this movie as a SWF, and keep both SWF files in the same directory.

When you release this button, the music in the first SWF file loads and plays.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint