Adding Sound

When adding sound to your Flash document timeline, you must add the sound to a keyframe. (See Chapter 4, "Flash Animation," for more information on keyframes.) That is also true for adding to both a Movie Clip timeline and a Button timeline. Go through the following steps to see how it's done:

In this walkthrough, you will be adding a sound to the Down frame of a button so that when a user clicks it, a sound occurs.


Create a new Flash document and save it as buttonSound.fla.


You can either create your own button from scratch, or grab one from the common libraries included with Flash by going to Window, Common Libraries, Buttons, which will open up similar to Figure 6.1.

Figure 6.1. The Button library in Common Libraries.

For this walkthrough, I chose the Arcade button style because it will go well with the sound we are going to add to it. Remember, adding the right sound to your interaction is key; you want to make users believe that they are actually experiencing the interactions on your websiteas if they were there. For this example, you want users to feel like they are actually pressing an arcade button instead of clicking a graphic.


Whether you created a button from scratch or are using one from the common libraries, drag an instance of it onto the stage.


We are going to use a click sound called click.wav. You can grab it from the companion website of this book. After you have it somewhere on your system, choose File, Import, Import to Library; then map to the sound file and click Open. This will add the sound to your library, as shown in Figure 6.2. You can also test the sound at this point by selecting it in the library and clicking the Play button in the Preview pane.

Figure 6.2. You can see the sound file in the library and, if selected, can also test it right there.


Select the button on the main stage and choose Edit, Edit Selected (or double-click it) to take you into Edit mode of the button.


Insert a new layer at the top of the button and name it click.


In the Down frame of the Click layer, insert a keyframe by selecting it and choosing Insert, Timeline, Keyframe (or use F6).


While still in that frame, and with the library open, select click.wav and drag it onto the stage. You will see a squiggly line appear in the frame itself, as shown in Figure 6.3, indicating that a sound file is in there.

Figure 6.3. The timeline after a sound file has been placed on the stage.


Test the movie now, and you will hear a click sound when you click the button.


When placing sound in the timeline of a Movie Clip, never put it in the first frame. This will cause difficulty when fixing issues with the sound, such as not being able to make it stop playing when you move through the timeline. It can be even worse in older versions of the Flash player. So remember to put the sound at frame 2 or later.

Now that you have seen how to add sound to your Flash documents, let's go over how to control them after they are there.

Macromedia Flash Professional 8 Unleashed
Macromedia Flash Professional 8 Unleashed
ISBN: 0672327619
EAN: 2147483647
Year: 2005
Pages: 319 © 2008-2017.
If you may any questions please contact us: