Instruction: Instructor will show students how to import and play simple audio files. Instructor will also show how to create simple controls for those sounds.
Description: This lab consists of three parts. Exercise 1 involves incorporating sinple sounds into an animation. Exercise 2 involves lip syncing a character. Exercise 3 involves using simple ActionScript to control sounds.
Note: All resource files needed to complete these exercises are on the G drive.
Directions - Exercise 1: Boing
Create a new flash document, set the frame rate to 24 fps.
Create a red circle, making sure to select both the fill and the stroke of the circle, convert it to a graphic symbol named “Ball.”
Delete the ball from the stage; you should still have the symbol in the library.
Go to Insert>New Symbol to create a new movieclip symbol named “bounce.”
Make sure you are editing your newly made “bounce” symbol; drag an instance of “ball” onto the stage.
Create a keyframe at frame 20, on this new keyframe, move the ball symbol down.
Copy the keyframe at frame 1 to frame 40.
Select any frame between frame 1 and frame 20, right click and select “add motion tween”; add another tween between frame 21 and frame 40.
Above the timeline, click the “Scene 1” tab to go back to editing the main timeline.
Drag an instance of the “bounce” symbol to the stage.
Press ctrl-enter to see the animation.
The ball bounces, but it is very chunky and unrealistic.
Double click the “bounce” symbol in the library to edit it.
Click anywhere along the first tween, then change its ease property to -100, this makes the tween start slowly and speed up near its end; it’s known as easing in.
Change the ease on the second tween to +100, this makes the tween start quickly but slow down towards its end; it’s known as easing out.
Play the animation again; hopefully it looks much smoother now.
Make sure you are still editing the bounce symbol; add a new layer called “SFX.”
Download the sound file "boing_2.wav." You will use this sound file in this exercise.
Import the sound file “boing_2.wav” by selecting file>import>import to library, or drag the file directly into the library from outside of flash
Create a keyframe on frame 20 of the SFX layer.
While in the new keyframe, drag an instance of the sound onto the stage from the library.
You won’t see anything different on the stage, but the SFX layer now displays the sound.
Select frame 20, in the properties panel, set sync: to event, then click the edit button to the right.
In between the two wave images is the sound timeline, it has dashes and numbers in seconds on it. There are two bars on the timeline, one at the beginning and one at the end of the sound.
Move the first bar to the right to cut out the short “quiet space” at the beginning of the sound, taking the empty space off.
Save your file as LastName_Firstname_L3Ex1
Directions - Exercise 2:
With what you have learned from Exercise 1, finish lip-syncing the character after downloading the template .fla. If you wish, you may lip-sync one of your own characters to some audio file.
On the buttons layer, drag an instance of the btnStart symbol onto the radio (yes, that is a radio); you don’t need to name the instance yet.
Edit the btnStart symbol in the library; add a keyframe to the “down” state in the SFX layer.
Select the newly created keyframe, drag rockin1.wav from the library onto the stage; it will appear on the timeline.
Change the sync of the sound to “Event”.
Test the movie and press the green button, the sound is 14 seconds long. As you press the button multiple times, you will notice it plays multiple instances of the sound on top of one another. Sync:Event tells Flash to play the sound every time it reaches that frame.
Edit the btnStart symbol again, changing the sync of the sound to “Start”
Test the movie again. This time, only one instance of the sound plays, no matter how many times you press the button. Sync:Start tells Flash to start the sound, if it is already playing, it ignores this command.
Edit the btnStart symbol one more time; change the sound from “repeat” to “loop”. Obviously, this tells the sound to continue looping itself. Rockin1.wav is a sound intended to loop so there will be no break in the music when it loops.
Go back to the main timeline and drag an instance of the btnStop symbol onto the radio.
Edit the btnStop symbol, adding a keyframe on the “down” state in the SFX layer.
With this keyframe selected, select “rockin1.wav” from the “sound” dropdown in the properties bar. This does the same thing as dragging sounds from the library, but can be a timesaver if you end up with a lot of sounds.
Change the Sync of the sound to “Stop”.
Test the movie. After pressing the green button, the sound will loop until you press the red button.
Also included is a movieclip titled Thump with an instance already on the main timeline named “thump1”. If you click on the speaker (yes, it’s a speaker), you can see its instance name in the properties bar.
Click on the btn_start instance you created, the green button. Give it the instance name “btn_start” without quotes. Likewise, give the red button the instance name “btn_stop”.
In the main timeline, click on the first frame of the actions layer, then open the actions panel. There should be one line of code, “thump1.stop();” this tells the movieclip instance “thump1” to stop playing immediately as the movie starts. This prevents the speaker from thumping when there is no music playing.
Add the following code below the existing line of code.
// When the start button is pressed, play the thump1 movieclip
btn_start.onPress=function(){
thump1.play();
}
// When the stop button is pressed, stop the thump1 movieclip
btn_stop.onPress=function(){
thump1.stop();
}
19. The lines with forward slashes are comments and don’t affect the code.
20. Test the movie, as the music comes on, the speaker should “thump” in a cheesy manner.
21. Final Submission: Save your file as LastName_Firstname_L3Ex3. Submit all three exercise files in a single folder named Lastname_FirstName_L3.
For questions or comments concerning the course or website contact Ronald J. Glotzbach.