using flash buttons

Adding sound to each button

In this next step, we will add some audio to each of the buttons. Adding sound to the button timeline is a little counter-intuitive due to the way sound was originally designed to work in Flash. The idea is to have some audio play when we move the mouse arrow over a piece of equipment, and have the audio stop when we move the mouse off of the equipment.

First, we must import the audio files from tutorial materials to our Flash project. Click on the File menu at the top of the screen and from the import option select import to library.

import to library menu

Navigate to your sounds folder and while holding the shift key, select all of the sounds. This is an easy way to import multiple sounds at one time without having to repeat the process for each file.

selecting multiple sounds

Once you import your sounds, it is good practice to keep them organized in your library. Click on the new folder icon at the bottom of your library window and name the new folder sounds. Drag each audio file to the folder.

organizing the library

Now let's add some sound to each of the buttons. To start, double-click on one of the buttons on the stage that you created from the previous lesson. This will bring you into symbol editing mode. In this example, we will use the helmet button. Click on the over state in your timeline, highlighting the keyframe.

highlight the over state

Next, click on your properties window. Look under the section for sounds. (if you do not see the sounds menu in your properties window, try clicking on the over state keyframe again.) The sound name option will list all sounds that it finds loaded into your library. Pick the corresponding sound that matches with your button.

sound menu

Next set the sync option to start. The sync describes how the sound will be synced with the timeline. If we choose event, every time a person moves the mouse over the button a new instance of the sound will be played, and this will sound chaotic. The start option will make sure only one instance of the sound file is played until it is stopped.

sync menu

If you test the project now, you will see we are only have way done with the sound. It will play when we move the mouse arrow over the button, but will not stop when we move off of the button. This next step seems a little counter-intuitive, but it allows Flash to stop the sound that is playing. Next, click on the Up state in your timeline.

up state selected

Then in your properties window, you will repeat the process of setting the sound name to your audio file. However, this time set the sync to stop.

setting sync to stop

Now test your project and you will see how the sound plays when you move the mouse arrow over a button, and stops when you move it off of a button.