Accessibility

TechNote (Archived)

How to create a simple button

Buttons are a special type of symbol that contain 4 frames. Each frame of a button symbol represents a different "state" for the button: Up, Over, Down, and Hit. How a button visually behaves when the mouse is rolled over it or when the user clicks on the button is determined by these four states. This document explains how to create a basic button.

To create a new button, do the following:
  1. Select Insert > New Symbol, or press Control+F8 (Windows) or Command+F8 (Macintosh).

    Note: In Flash 3 and earlier, deselect everything on the stage and choose Insert > Create Symbol.
  2. 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.
  3. 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, but you cannot use another button in a button. Use movie clip symbols if you want to create an animated button.
  4. Select the second frame, labeled Over, and choose Insert > Keyframe. The button image from the first frame appears on the Stage.
  5. 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 graphic for the Hit frame 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.
  6. After defining the images of the four button states, choose Edit > Edit Movie to exit Symbol Edit mode.
  7. Open the Library window by choosing Window > Library. Locate the button in the Library window and then drag the button symbol out of the Library onto the Stage. This creates an instance of the button in the movie.

For information on assigning actions to the button instance refer to the documentation that applies the the version of Flash that you are using. The documentation follows below:

To assign a simple action to a button (Flash 5):
  1. In Edit Movie mode, select the button instance created in Step 7 above.
  2. Choose Window > Actions to open the Actions panel.
  3. In the Toolbox list on the left side of the panel, click the Basic Actions category to display the basic actions.
  4. 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.
  5. If the chosen action has any associated parameters, those parameters will 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 Go to and Play.

To assign a simple action to a button (Flash 4 and earlier):
  1. In Edit Movie mode, select the button instance created in Step 7 above.
  2. Make sure that Enable Buttons from the Control menu is unchecked.
  3. Double-click the button to get the Instance Properties dialog box.

    Note: In Flash 2 this was the Link Properties: Button dialog box.
  4. Assign the action by selecting the Action tab in the Instance Properties dialog box. Then, click the plus (+) button and double-click on 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 may be assigned to the button.
  5. Make sure that Enable Buttons in the Control menu is checked, so that option is toggled back on.
  6. If the selected action has any associated parameters, those parameters will appear in the Parameter panel on the right side of the Actions panel. Choose or type the parameters appropriate for that action.
Additional information

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. Flash 4 users 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.

For more details about buttons, see Flash button resources (TechNote 14427).

AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_4101
Browser:Chrome
Internet Explorer
Netscape
Opera
Safari
Firefox

Products Affected:

flash