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

Chapter 12. The Sound of Games > Managing Sound Effects

Managing Sound Effects

There are two ways to use sound effects in Flash. You can place a sound directly on a frame, or you can pull it from the library with ActionScript using attachSound(). Using frames to hold your sounds is easy and predictable; the sound plays when that frame is reached. The advantage of using this technique is that you can control the volume and other sound properties in the authoring environment. With attachSound(), the sound can be started or stopped using ActionScript. Further, you have control over the volume and panning of the sound in real time. With sounds placed on a frame, however, you cannot change these properties (pan and volume) of the sound after they have been set in the authoring environment—the game player's actions are not going to affect the properties. In short, as always, there are advantages and trade-offs either way. In this section we discuss both ways of using sound effects in your games through the use of several example files.

Sound Placed on Frames

I've seen the source files for many Flash games over the last few years, and one thing I often find is that people put their sounds all over the place. For example, in one of these files, the sound for each object was inside the movie clip for that object—a character-hopping sound was inside the character movie clip, the gunfire sound was inside the gun movie clip, and so on. There is nothing wrong with using sounds in this way, but it's not very efficient. Keeping track of your sounds is difficult, and it's not always easy to add new sounds.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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