8. Sounds



Sound is a very important part of the Flash movie. Generally you use sounds for background music, for buttons, to help an animation be more realistic and interesting.

In our templates we use sounds especially for background music (a sound loop - a sound that repeats over and over again) and for buttons.

Let's see how we can import a sound, create a loop, add a sound to timeline

Open the file index.fla from template/flash.

You can import a sound as you import any other element to Flash, using File->Import->Import to Library.

In our library we already have 3 sounds.

First of all let's talk about the sound loop, the sound that repeats in background.

Go to the Timeline and select the "Layer 18". This layer contains the sound that is looping. As you can see below if you click on the keyframe in which the sounds start the Properties palette shows you the sound properties:

Let's delete this sound from the canvas. To do that just go to the drop down menu in the properties palette and from the menu choose "none". Note that the drop down menu displays all the sounds in your library:

Now you have no sound loop.

To add a new sound just select the keyframe in which you would like to place it and from the same drop down menu described above select the desired sound.

Select the "Coffee..." sound. Now to make the sound repeats continuously from the sound options set the number of times you want that sound to repeat:

Don't set a huge number...99 is just OK. Now you set the sound to repeat for 99 times.

You can add sounds to every symbol in the same way. It is recommended to add the sound to an empty layer to not interact with other symbols.

Note that is recommended to import .wav sounds in Flash because they are better reproduced as sound loops and not only. Most of the times an mp3 file set as sound loop is played like a scratched disk (with a pause at the end of a cycle). Don't be afraid to import wav files to flash because they are bigger, Flash will compress the as mp3 files when you export the movie. So it is recommended to work with wav files. In our example we use mp3 file but this doesn't affect dramatically our sound loop.

The loop sound in this template is control using the "sound_control" movie clip. This movie clip and the Actionscript associated with it let us turn on/off the background music. It is not recommended to modify the Actionscript code for this movie because the on/off switch will not work correctly.