Adding Sounds to a Button

I l @ ve RuBoard

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.

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

    graphics/06fig09.gif

    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.

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

    graphics/06fig10.gif

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

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

    graphics/06fig11.gif

    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.

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

    graphics/06fig12.gif

    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.

  5. 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.

  6. 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.

    graphics/06fig13.gif

    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.

  7. 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.

I l @ ve RuBoard


Macromedia Flash MX. Training from the Source
Macromedia Flash MX: Training from the Source
ISBN: 0201794829
EAN: 2147483647
Year: 2002
Pages: 115
Authors: Chrissy Rey

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net