You can use behaviors to control movie clip and graphic instances in a document without writing ActionScript. Behaviors are pre-written ActionScript scripts that let you add the power, control, and flexibility of ActionScript coding to your document without having to create the ActionScript code yourself.
You can use behaviors with an instance to arrange it in the stacking order on a frame, as well as to load or unload, play, stop, duplicate, or drag a movie clip, or to link to a URL. In addition, you can use behaviors to load an external graphic into a movie clip.
To control a movie clip with a behavior, you use the Behaviors panel to apply the behavior to a triggering object, such as a button. You specify the event that triggers the behavior (such as releasing the button), select a target object (the movie clip instance) that is affected by the behavior, and when necessary, specify settings for the behavior parameters, such as a frame number or label.
The behaviors in the following table are packaged with Flash MX 2004 and Flash MX Professional 2004.
To add and configure a behavior:
1. Select the object, such as a button, that will trigger the
behavior.
In the Behaviors panel (Window > Development Panels > Behaviors), click
the Add (+) button and select the desired behavior from the Movieclip submenu.
2. In the dialog box that appears, select the movie clip that
you want to control with the behavior.
3. Select a relative or absolute path. For more information, see Absolute paths
and Relative paths.
4. If required, select or input settings for the behavior parameters and click
OK.
Default settings for the behavior appear in the Behaviors panel.
5. Under Event, click On Release (the default event) and select a mouse event from the menu. If you want to use the On Release event, leave the option unchanged.
Behaviors & Purposes
Load Graphic
Loads an external JPEG file into a movie clip or screen.
Path and filename of JPEG file.
Instance name of movie clip or screen receiving the graphic.
Load External Movie Clip
Loads an external SWF file into a target movie clip or screen.
URL of external SWF file.
Instance name of movie clip or screen receiving the SWF file.
Duplicate Movieclip
Duplicates a movie clip or screen
Instance name of movie clip to duplicate.
X-offset and Y-offset of pixels from original to copy.
GotoAndPlay at frame or label
Plays a movie clip from a particular frame.
Instance name of target clip to play.
Frame number or label to play.
GotoAndStop at frame or label
Stops a movie clip, optionally moving the playhead to a particular frame.
Instance name of target clip to stop.
Frame number or label to stop.
Bring to Front
Brings target movie clip or screen to the top of the stacking order.
Instance name of movie clip or screen.
Bring Forward
Brings target movie clip or screen one position higher in the stacking order.
Instance name of movie clip or screen.
Send to Back
Sends the target movie clip to the bottom of the stacking order.
Instance name of movie clip or screen.
Send Backward
Sends the target movie clip or screen one position lower in the stacking order.
Instance name of movie clip or screen.
Start Dragging movieclip
Starts dragging a movie clip.
Instance name of movie clip or screen.
Stop Dragging movieclip
Stops the current drag