• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Lesson 4. Creating Animation > Using a Movie Clip to Create an Animated Button

Using a Movie Clip to Create an Animated Button

Movie clips are essentially movies inside other movies. They're good for animations that run independently of the main movie's timeline. Movie clips can contain interactive elements (actions), other symbols, and sounds. They can also be placed inside other symbols and are particularly useful for creating animated buttons. You created a movie clip in the preceding exercise; now you'll put that movie clip in a button to animate the button.

You should still have neptune18.fla open from the preceding exercise.

1.
Choose Insert > New Symbol to create another new symbol. In the Symbol Properties dialog box, type Reservations Button in the Name text box, select the Button radio button, and click OK.

You just made an empty button. Notice that the button's timeline is significantly different from the other timelines you've seen. A button has four states: Up, Over, Down, and Hit. Each state is defined in a frame of the same name.

The Up state is how the button appears on the screen when it first appears. The Over state becomes visible when you move the mouse pointer over a button on the stage. When you click a button, the Down state is revealed. The Hit state is not visible in your movie; it defines the active area of a button. The active area can be larger or smaller than the visible button and can even have a different shape. Button symbols can have graphic symbols, movie clips, and sounds in the first three frames.

2.
Select the Up frame. Use the text tool to create a text box containing the word Reservations. Center the text box horizontally and vertically on the stage.

Use the Character panel to set the font to Arial, font height to 18, font tracking to 0, and font color to cyan (#33FFFF). If you haven't made any changes in the Character panel since the preceding exercise, these settings should still be there.

3.
Select the Over frame, and choose Insert > Blank Keyframe. Drag an instance of the Animated Text: Reservations movie clip onto the stage and center it horizontally and vertically on the stage.

Remember that the Animated Text: Reservations movie clip is a symbol. Like all symbols, it's stored in the library.

You've added an animation to the button. When you add the button to a movie, that button responds to mouse actions. Initially, you see only the text Reservations. But when you move the mouse over the text, you see the Animated Text: Reservations movie clip.

You have to add only one more thing to your button to make it work perfectly: a Hit state.

4.
Select the Hit frame, and choose Insert > Blank Keyframe. Draw a rectangle, and set its width to 105 and its height to 20. Center the rectangle horizontally and vertically on the stage.

Without a Hit area, you'd have a hard time clicking the button. The Hit state is not visible in your movie, so the color of the rectangle doesn't matter. The only thing that matters is the size of the rectangle, because it acts as the hit area for the button.

You're done making your button. Now you have to add it to the movie.

5.
Choose Edit > Edit Movie. Insert a new layer, named Navigation Buttons, to the top of the layer stacking order. Insert a keyframe at frame 15 of this new layer.

This keyframe is where you're going to add the button that you just made.

6.
With frame 15 of the Navigation Buttons layer selected, drag an instance of the Reservations Button symbol onto the stage. Use the Info panel to position it at X: 15 and Y: 85.

The button is now on the stage, but you can't preview it in all its animated glory without testing the movie. The reason is that the button contains a movie clip for its animated Over state, and you cannot preview movie-clip animations in movie-editing mode.

7.
Choose Control > Test Movie. When the exported movie appears, choose Control > Loop to keep it from looping through the animation repeatedly. The movie will stop. Move the mouse over the Reservations Button symbol to see the animated button state.

When you move the mouse over the button, you should see the animated movie clip that you created. The clip will loop continuously, which is what movie clips (and movies in general) do by default.

8.
Choose File > Close to close the test-movie window. Save the movie as neptune19.fla in the MyWork folder.

You're done with the movie for now. In the next lesson, you'll learn how to add sound to your movie.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint