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

Chapter 8. Controlling Sound > Loading External Sounds

Loading External Sounds

Each time you use the Linkage Properties dialog box to identify a sound in the library and mark it for export, that sound is added to your SWF file, 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 stays small is to keep sounds as separate files outside your Flash movie. Use the method loadSound() to bring MP3 sounds into Flash and associate them with a Sound object only when you need them. (MP3 is the only allowable format.) This method also allows you to change the sound file easily without having to edit your Flash movie. You can maintain several background-music tracks that users can choose among, for example. To turn the music on, you use the method loadSound(). To choose a different track, you call the method again and load a different sound file.

The method loadSound() requires two parameters. The first parameter is the path to the MP3 file. The second parameter determines whether you want the sound to be a streaming or an event sound. Enter true for streaming or false for not streaming (event). Streaming sounds will begin to play as soon as enough data downloads. For this reason, streaming sounds do not need the start() method. Event sounds, however, must download in their entirety and do require the start() method to begin playing.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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