beautypg.com

Symbols and actionscript, Controlling instances with behaviors – Adobe Flash Professional CC 2014 v.13.0 User Manual

Page 663

background image

Symbols and ActionScript

To the top

To the top

Controlling instances and symbols with ActionScript
Controlling instances with behaviors
Add and configure a behavior
Create custom behaviors

With ActionScript®, you can control symbols at runtime. Using ActionScript allows you to create interaction and other capabilities in your FLA files
that are not possible with the Timeline alone.

Controlling instances and symbols with ActionScript

To control movie clip and button instances, use ActionScript®. The movie clip or button instance must have a unique instance name to be used
with ActionScript. You can write the ActionScript yourself or use the pre-defined behaviors included with Flash Professional.

For more information, see Handling events in

Learning ActionScript 2.0 in Adobe Flash

or

Handling events

in the ActionScript 3.0 Developer’s

Guide.

Controlling instances with behaviors

In FLA files where the ActionScript Publish setting is set to ActionScript 2.0, you can use behaviors to control movie clip and graphic instances in a
document without writing ActionScript. Behaviors are prewritten ActionScript scripts that let you add ActionScript coding to your document without
having to create the ActionScript code yourself. Behaviors are not available for ActionScript 3.0.

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 or an animated mask into a movie clip.

Flash Professional includes the behaviors in the following table.

Behavior

Purpose

Select or input

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 Movieclip

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.

Goto And Play 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.

Goto And Stop 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

Instance name of movie clip or screen.

656