Keyframes
Each layer of a Flash movie is divided into frames. Frame numbers appear along the top of the Timeline. At the current time, each layer in your movie is only one frame long. You want your movie to last 60 frames. Inserting a keyframe at Frame 60 will cause each layer to remain on the screen until Frame 60. You use keyframes to specify changes in the animation.Extend the Sky Layer
Extend the Trees Layer- Click in Frame 60 of the Sky layer.
- Choose Insert > Timeline > Keyframe from the menu.
- Click in Frame 60 of the Buildings layer.
- Choose Insert > Timeline > Keyframe from the menu.
- Click in Frame 60 of the Trees layer.
- Choose Insert > Timeline > Keyframe from the menu.
Create a new layer. Name the layer Car.
- Make the Trees layer the active layer by clicking on the Trees layer name.
- Choose Insert > Timeline > Layer from the menu to create a new layer above the Trees layer.
- Choose Modify > Timeline > Layer Properties from the menu.
- Type Car in the Name field.
- Click OK.
- Click the first frame of the Car layer.
- Move to the Library panel.
- Click the icon next to the car and drag a copy of the car onto the Stage.
- Choose the Free Transform tool. Handles appear around the car.
- Click and drag a corner handle until the car is the appropriate size. Corner handles resize the selected object proportionally.
Motion Tween
Make the Car Move- Choose the Selection tool.
- Click and drag the car to the right side of the Stage as shown here.
- If the Property inspector is not open, choose Window > Properties > Property from the meun to open the Property inspector.
- Click Frame 1 of the Car layer.
- In the Property inspector, choose Motion in the tween field.
- Click Frame 60 of the Car layer.
- Choose Insert > Timeline > Keyframe from the menu to make frame 60 a keyframe.
- Use the Arrow key to move the car to the left side of the Stage as shown here.
- Choose Control > Play from the menu to play the movie. Your car moves across the Stage.
Adding Sound
To have a horn honk as the car rolls through town, you need to add sound.Import the Horn Sound
- Click here to download the horn sound. Open the Zip file and place the shorthrn.wav file in a folder.
- Choose File > Import > Import to Library from the menu. Find and select shorthrn.wav and click Open. The file shorthrm.wav now appears in the Library.
Create and name a new layer:
- Click the Car layer name to make the Car layer the active layer.
- Choose Insert > Timeline> Layer from the menu to create a new layer. The new layer appears above the Car layer.
- Choose Modify > Timeline > Layer Properties from the menu and type Horn in the Name field to name the layer Horn.
- Click OK.
- Click Frame 30 on the Horn layer.
- Choose Insert > Timeline > Keyframe from the menu to make Frame20 a keyframe.
- Move to the Library. If the Library is not already open, choose Window > Library from the menu.
- Drag shorthrn.wav from the Library onto the Stage.
- Click Frame 20.
- Choose Event from the drop-down menu in the Sync field of the Property inspector.
- Choose Control > Test Movie from the menu to play the movie.
- Click the Close button to return to Flash Professional 8.
Stopping the Action
If you published your movie now, the car would start moving as soon as the viewer entered the screen. You want the viewer to click on a button to make the car move. In this exercise you will add a behavior to stop any action before the viewer clicks a button. Later, you will add a button for the viewer to click to start the action. You will use behaviors to control the action. Generally you use ActionScript, a scripting language, to control the action in a Flash document. However, behaviors allow you to control some actions even if you do not know ActionScript.Stop the Action
Add a new layer:
- Click the Horn layer to make it the active layer.
- Choose Insert > Timeline > Layer from the menu to add a new layer.
- Choose Modify > Timeline > Layer Properties from the menu. The Layer Properties dialog box opens.
- Type Stop Action in the Name field.
- Click OK.
- Choose the Selection tool.
- Click Frame 1 on the Stop Action layer.
- Choose Window > Behaviors from the menu.
- Click the plus sign in the Behavior panel. A context menu opens.
- Choose Movieclip > Goto and Stop at Frame or Label. The Goto and Stop at Frame or Label dialog box opens.
- Make sure there is a 1 in the Frame number field. This tells Flash to stop at Frame 1.
- Click OK.
- Choose Control > Test Movie from the menu to play the movie. Your car should not move.
- Click the Close button to return to Flash.
Adding a Button
Buttons have four states: up, over, down, and hit.The Four Button States | |
Up | The appearance of the button when the pointer is not over it |
Over | The appearance of the button when you place the pointer over it |
Down | The appearance of the button when you click it |
Hit | Defines the area that will respond to a click of the mouse |
Create a New Layer
- Click the Horn layer to make the Horn layer the active layer.
- Choose Insert > Timeline > Layer from the menu to create a new layer.
- Choose Modify > Timeline > Layer Properties from the menu.
- Type Button in the Name field to name the layer button.
- Click OK.
- Move to the Library. If the Library panel is not open, choose Window > Library from the menu.
- Click on the icon next to Start Button and drag the Start Button onto the Stage.
- Choose Edit > Edit Symbols from the menu to change to the symbol-editing mode.
- Choose the Selection tool.
- Click the Over frame to select it.
- Choose Insert > Timeline > Keyframe from the menu. The Over frame becomes a keyframe.
- Click outside the button to deselect it.
- Click the fill color to select it.
- Click the Fill color box and select green to change the fill color to green.
- Click the Down frame to select it.
- Choose Insert > Timeline > Keyframe from the menu.
- Click outside the button to deselect it.
- Click the fill color to select it.
- Click the Fill color box and select brown to change the fill color to brown.
- Click the Hit frame to select it.
- Choose Insert > Timeline > Keyframe from the menu.
- Choose Edit > Edit Document from the menu. You have created a button.
- Choose the Selection tool.
- Click the button to select it..
- Choose Window > Behaviors from the menu if the Behaviors panel is not open.
- Click the plus sign in the Behavior panel. A context menu opens.
- Choose Movieclip > Goto and Play at Frame or Label. The Goto and Play at Frame or label dialog box opens.
- Make sure there is a one in the Frame number field.
- Click OK.
- Choose Control > Test Movie from the menu. The Test Movie window opens.
- Click the Start Button to make the car roll.
- Close the window.
The Text Tool
You need to put a label on the Start Button and add a title to the movie. You will use the Text tool for this.Add Text to the Button
- Click the Text tool to select it.
- Choose Text > Font from the menu and select a font. I used Arial Black.
- Choose Text > Size > 24 from the menu to set the font size to 24.
- Click the Fill color box and select gold as the color.
- Type Start Movie on the button.
- Click anywhere outside the Stage to close the text box.
- Use the Selection tool to adjust the placement of the text. Remember, you can also use the arrow keys to change the placement.
- Click anywhere outside the Stage to deselect the text box.
- Choose the Text tool.
- Choose Text > Size > 24 from the menu.
- Click the lower left corner of the Stage.
- Type My First Movie.
- Click anywhere outside the Stage.
- Choose Control > Test Movie from the menu. The Test Movie window opens.
- Click the Start Movie button. The movie should play.