Buttons are symbols that contain four frames. Each frame of a button symbol represents a different state for the button: Up, Over, Down, and Hit. These states determine how a button visually behaves when the mouse is rolled over it or when the user clicks the button. This document explains how to create basic and advanced buttons.
Create a basic button
- In the Symbol Properties dialog box, enter a name for the new button symbol and choose Button as the Behavior option. Click OK.
Flash switches to symbol-editing mode. The Timeline header changes to display four consecutive frames labeled Up, Over, Down, and Hit. The first frame, Up, is a blank keyframe.
- To create the Up state button image, use the drawing tools, import a graphic, or place an instance of another symbol on the Stage. You can use either a movie clip or graphic symbol in a button. However you cannot use another button in a button. Use movie clip symbols if you want to create an animated button.
- Change the button image for the Over state. Repeat steps 4 and 5 for the Down frame and the Hit frame.
Note: The Hit frame is not visible on the Stage on playback, but it defines the area of the button that responds when clicked. Make sure that the Hit frame graphic is a solid area large enough to encompass all the graphic elements of the Up, Down, and Over frames. It can also be larger than the visible button. If you do not specify a hit frame, the objects in the Up state are used as the hit frame.
For information on assigning actions to the button instance, see the documentation that applies the version of Flash that you are using. The documentation follows below:
- To assign an action, do one of the following:
- Double-click an action in the Basics Actions category.
- Drag an action from the Basic Actions category on the left to the Actions list on the right side of the panel.
- Click the Add (+) button and choose an action from the pop-up menu.
- Use the keyboard shortcut.
- If the chosen action has any associated parameters, those parameters appear in the Parameter pane at the bottom of the Actions panel. (If the Parameter pane is not visible click the small triangle in the lower right corner of the panel.) Choose or type the parameters appropriate for that action. For example, thegotoAndPlay action shown below contains three parameters: Scene, Type, Frame, and an option for Goto and Play.
- Assign the action by selecting the Action tab in the Instance Properties dialog box. Then, click the plus (+) button and double-click the appropriate action.
Note: In Flash 2 assign the action using the Action pop-up menu in the Link Properties: Button dialog box. Only one action can be assigned to the button.
Create advanced buttons
After you've mastered a simple button, try more complex Flash buttons. You can create invisible buttons, buttons with animated states, and buttons with rollover effects.
Hit states are important to understand when designing a complex button. The button's shape and area represent the active area of the button. To experiment with the Hit state, do the following:
The Up, Over and Down states of a button can be left empty. If these states are empty, it's necessary to define the Hit state so that it contains content.
When the Up state of the button is empty or invisible, the button is represented on the Stage by a blue shape. The shape is the equivalent to the content in the next Keyframe within the button. This blue shape isn't visible in your final movie. See the example below.
See the example below.
To create this effect, move the Hit state elements to a different area of the Stage than elements in the Over state of the button. This method works for simple rollover effects. The active area of the button is located in a different area onstage than the rollover effect. See the example below
A good way to learn more about buttons and their construction is to study the buttons included as samples with Flash. In Flash 5, these sample buttons are available from the Windows > Common Libraries > Buttons menu. If you use Flash 4, you can access these buttons by choosing Libraries > Buttons. For Flash 2, the libraries of sample buttons are accessible from the Xtras menu.
A walkthrough of creating a button is also available in the Lessons that come with Flash 5. Choose Help > Lessons > 06 Buttons from within Flash to access this lesson.