Creating Interactive Movies > Assigning actions to objects
Assigning actions to objectsYou can assign an action to a button or a movie clip to make an action execute when the user clicks a button or rolls the pointer over it, or when the movie clip loads or reaches a certain frame. You assign the action to an instance of the button or movie clip; other instances of the symbol aren't affected. For a description of the actions you can add, see Using basic actions for navigation and interaction.
When you assign an action to a button or a movie clip, Flash automatically assigns a special action called a handlerthe On Mouse Event action for buttons or the On Clip Event action for movie clips. A handler manages an event in a certain way and contains groups of ActionScript statements that run when a specific event occurs. Each handler begins with the word on
or onClipEvent
followed by the event to which the handler responds.
Events are actions that occur while a movie is playingfor example, a movie clip loading, the playhead entering a frame, or the user pressing a key on the keyboard. You can specify the mouse event or keyboard key that triggers the action; see Setting mouse event options. You can also specify the clip event that triggers the action; see ActionScript Help.
Once you've assigned an action, it's recommended that you test whether it works. Only simple frame actions such as Go To and Play work in editing mode.
The following instructions describe how to set actions for objects using the Actions panel in Normal Mode. For information on using the Actions panel in Expert Mode, see ActionScript Help.
To assign an action to a button or movie clip:
1 | Select a button or movie clip instance and choose Window > Actions. |
If the selection is not a button instance, a movie clip instance, or a frame, or if the selection includes multiple objects, the Actions panel will be dimmed. | |
(For information on assigning an action to a frame, see Assigning actions to frames.) | |
2 | In the Toolbox list on the left side of the panel, click the Basic Actions category to display the basic actions. |
For a description of the actions you can add, see Using basic actions for navigation and interaction. | |
3 | To assign an action, do one of the following: |
![]() |
Double-click an action in the Basics Actions category. |
![]() |
Drag an action from theBasic 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 you selected a movie clip, Flash automatically inserts the On Clip Event action and the action you selected in the Actions list. If you selected a button, Flash automatically inserts the On Mouse Event code to trigger any selected action. | |
4 | To display the Parameters pane, click the triangle in the lower right corner of the Actions panel. Select the action and enter new values in the Parameters text boxes to change parameters of existing actions. |
Parameters vary depending on the action you choose. For example, the default On Clip parameter is Load. See Using basic actions for navigation and interaction for information on parameters for the most commonly used actions. | |
5 | Repeat steps 3 and 4 to assign additional actions as necessary. |
![]() |