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

Lesson 6. Using Sound and Video > Adding Sounds to a Button

Adding Sounds to a Button

Adding sounds to buttons is similar to adding sounds to the timeline. By adding a keyframe and inserting the sound into that state of the button, you can place a sound in any of the three active states of the button: Up, Over, and Down. In the following exercise, you will add a sound to the Visitor Info Button you created in Lesson 5.

Open the Visitor Info Button symbol in zoo26.fla in symbol-editing mode. Name the existing layer Graphics, and add a layer named Sounds.

The simplest way to open a symbol in symbol-editing mode is to double-click the symbol's icon in the library. (You must click the icon, not the name; double-clicking the name only highlights the name.) You can also select the symbol's name in the library and then choose Edit from the Library window's Options menu. Or you can choose Edit > Edit Symbols and select the symbol in the library.

In the timeline, select the Down frame in the Sounds layer, and insert a keyframe.

Adding a keyframe to the Down state lets you add a sound that plays only when the button is clicked.

With the new keyframe selected, choose Window > Common Libraries >> Sounds. Select a sound in the Sounds library, and drag it onto the stage.

The sound you choose is the one you will hear when you click the Visitor Info Button. You can use any sound you like. If you'd like to test the sound, click the Play button in the top-right corner of the library.

In the Sound layer, select the Down frame. From the Sync pop-up menu in the Property inspector, choose Event.

Remember that because event sounds play each time they are triggered, they can overlap. Each time you click the Visitor Info Button, the sound will play.

Choose Control > Test Movie. When Flash opens the movie in the Test Movie window, click the instance of the Visitor Info Button symbol.

If you click the button once, you hear the sound once. If you click the button more than once, the sound starts to overlap; it keeps getting triggered because the Sync for this sound is set to Event.

Close the Test Movie window when you've finished testing the button.

Open the Visitor Info Button symbol in symbol-editing mode, and change the Sync of the sound in the Down frame to Start. Test the movie again, and click the button.

Sounds that have a sync setting of Start play all the way through when they are first triggered. If a sound of this type is triggered again before it finishes playing, it won't start playing again. So when you keep clicking the button, the sound will not overlap.

Save your movie in the FlashTFS folder as zoo27.fla.

Working with sounds in Flash has been fairly painless so far. Now you're going to get into something more complicated: customizing sound effects.



Not a subscriber?

Start A Free Trial

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