| |
||||||||||
|
|
Advanced Methods | Adding Sound |
|
|
|
||||||
|
Adding Sound to the Timeline
You can add sound to the Flash timeline the same way that you add anything else, by putting it on the stage with the movie positioned at the desired point in the timeline. Let's illustrate by adding some sounds to our start button states. (You can add sound to any timeline using this method, not just to buttons.) Getting Some Sounds First we need some sounds. You can import your own sound files, but we will do something simpler. (See the online help files to see how to import your own sounds). Flash has a built in library of some basic sounds that we will use for our example. In the main menu choose "Libraries" > "Sounds". A window should open that has a library of short sound files. You can scroll through the list and test the sounds by selecting the sound with the mouse and then clicking the "Play" button in the upper right corner of the library window (the right arrow symbol). If your computer has sound enabled, you should hear the sounds play. Add Keyframes Be sure the button symbol that you created is not enabled (toggle off "Control" > "Enable Buttons") and double click on the button, select the "Definition" tab, and click the pencil symbol at the bottom to bring up the editing screen for the button symbol. We can only insert things into the timeline in key frames so first we have to add some key frames. Create a new layer on the timeline by clicking the white square with a "+" on it in the lower left of the timeline (or choose "Insert" > "Layer" from the menu). Give the layer a name like "sounds". Be certain that the new "sounds" layer is selected and use right clicks with the mouse on the corresponding cells of the timeline to insert key frames (as described above) in both the "Over" and "Down" cells. Now we are going to add two sounds. Use the mouse to position the timeline on the "Over" cell, be sure the new "sounds" layer is selected, and select the sound called "Visor Hum Loop" from the scrolling menu in the sound library (or select a different sound if you prefer). To insert it in the timeline, grab the waveform image for the sound in the upper part of the sound library window with the mouse (you have to grab the image in the upper window, not the file name in the scrolling list), drag it to any part of the stage, and release the mouse. The waveform image should appear in the selected cell of the timeline, indicating that the sound has been inserted. Nothing appears on the stage when a sound file is inserted; you can only see it in the timeline. Dragging Sounds to the Stage Now, position the timeline on the "Down" cell (being sure that the "sounds" layer is still selected), select the sound called "Camera Shutter 35mm" in the sounds library, and drag its waveform to the sound stage. That's it! You have now added two sounds to the button symbol timeline; the first should play when the mouse is over the button and the second should play when the button is pressed with the mouse. Choose "Edit Movie" from the main menu to return to the main movie, toggle "Control" > "Enable Buttons" to enable the button and test it. Now, in addition to changing color, the button should emit a low humming sound when you hold the mouse over the button and a camera shutter click when the button is pressed. This may or may not be what you want a button to do, but it illustrates the kinds of things that you can do with a button. Save your work, if you haven't done so recently. An Exercise: Make a Stop Button So let's test your knowledge. See if you can make a second "Stop" button that stops the animation. You can follow exactly the stops given above, except use the word "Stop" in place of "Go", and in assigning button actions select the command "Stop" in where the command "Play" was selected before. A faster way to do this is to duplicate the "Go" button symbol, give it a new name (this is essential; otherwise any changes that you make will change the original button), and edit it to turn it into a "Stop" button. You can find the simple instructions to duplicate and rename it in the help files. But we suggest for this example that you create it from scratch to get some practice in how to do it.
| ||||||||||
| |
||||||||||