Using Library Sounds

[ LiB ]

Macromedia Flash includes built-in libraries that contain plenty of stock buttons and sounds. They can easily be used in any project simply by dragging the object onto your stage.

To access these common libraries, go to your Window menu, Common libraries, Sounds.fla. The Library window, shown in Figure 10.1, should open .

Figure 10.1. Accessing common libraries


To make a sound play at a certain frame, make sure there is an empty keyframe on the layer you're working in and drag the sound from the library onto your stage while selecting that frame on the timeline. You will get a graphical representation of the sound drawn in the timeline, just like in Figure 10.2.

Figure 10.2. A sound event within the Timeline


Once the sound is in your movie, it will automatically be loaded into your movie's Library window. When the movie is played, the sound will be played unless ActionScript controls it otherwise . And that's all that there is to that.

What if you have a sound that you would like to use on your hard drive? Or even a song that you wrote and saved as a WAV or MP3 file? The easiest way to do this is by going to File, Open as Library. Once you open the sound file you will have another Library window with nothing but the sound you opened. To import the sound to your project, just drag it to the frame you want or to your movie's library.

Once you have a sound on your Timeline, you can adjust its properties and its behavior. Figure 10.3 shows what a sample Properties panel would look like when a keyframe that is selected contains a sound.

Figure 10.3. Adjusting a sound's properties


The Sound drop-down menu allows you to select a sound that is within the movie's library. The currently selected sound is the one that will play when the frame is played.

The sound can also be edited. The Edit drop-down box adds predefined effects, such as fadein and fade-out, to the sound. You can either choose custom from the list or click on the Edit button next to the drop-down box to edit the sound envelopes yourself. See Figure 10.4.

Figure 10.4. Editing a sound's envelopes




A sound envelope (in Flash) is merely an effector, a visual handle that you can move around to adjust the envelope that's applied to the sound's original data. In Flash, you can adjust volume envelopes by dragging and placing effectors. If you would like to place one, just click where you want to place one on the sound wave representation. If you would like to remove one, simply drag it out of the box. Notice where I placed the effectorsthe little hollow squaresin Figure 10.4 ; you can adjust the left and right channels separately.

An important term you should know is sound envelope . A sound envelope is like a chain of points, often expressed visually as a spline curve or a series of connected lines (like a graph) that represent changes made to some property of a sound. For example, if you draw a volume envelope over a sound, the higher parts of the envelope mean the sound will be played louder at that point, while the lower points mean the sound will be played quieter.

The next drop-down box that you see in your Properties window is labeled Sync. Your selection in this box determines how the sound is played. If it's a short sound that should play when an event happens, then choose Event. If the event occurs more than once and the first sound hasn't finished playing, all the subsequent sounds will play along simultaneously . If you set the Sync to Start it won't let any other Start sounds play along with this sound. If you choose Stop, the specific sound will be silent. If you choose Streaming, the sound will be synchronized to your frames. This is handy for Web sitesif the user 's computer is too slow to process all the frames on time while the sound is playing, the Flash player will skip frames to compensate for the time lost.

The Loop option in your Properties window will give you the option of making the sound loop a certain number of times. This is useful if you have a loop-able beat or some other type of music that can repeat with no interruptions. If you would like it to loop nearly forever, just type in a ridiculously high number like 99,999.

[ LiB ]

Game Development with ActionScript
Game Development with ActionScript
ISBN: 1592001106
EAN: 2147483647
Year: 2004
Pages: 162
Authors: Lewis Moronta © 2008-2017.
If you may any questions please contact us: