Symbols

Symbols

Flash CS4 ActionScript 3.0 Tutorial

 

How to Add ActionScript to Flash Symbols

 

 

Symbols come in three flavors, Button Symbols, Movie Symbols and Graphic Symbols. It is important that you can tell the difference between symbol types because out of the three, Graphic Symbols are the only ones that can not be used with ActionScript. Each of the symbol types has a unique icon in the Library.

Adding a Symbol to the Stage

Symbols can be added by dragging them from the Library or by opening up the symbol properties in the Library and choose Export for ActionScript. For more information on Exporting for ActionScript, see topic, Export Library Movie Symbol for ActionScript.

Assigning an Instance Name

For ActionScript to talk to a Symbol, the Symbol must first be assigned an instance name. For more information, see topic, Instance Naming.

Working with Symbols

There are several Symbol tutorials in the Flash CS4 Basics section. A good place to start would be the topics, Button Symbol Basics and Movie Symbol Basics.

In this example we will alter a Symbol's property (alpha) with ActionScript.

Tutorial Elements

Movie Symbol with instance name newMovie_mc

 

Step One

Add a Movie Symbol to the stage and select the symbol with the Selection tool (v key).

Step Two

Open the Properties panel (Cmd/F3 (PC-Ctrl/F3)) and type in the name newMovie_mc for the Instance Name.

Step Three

Add a new layer called Actions.

Step Four

Option double-click (PC - Alt double-click) the keyframe in the Actions layer to open the ActionScript panel.

Step Five

Copy/Paste the following code to the ActionScript panel.

newMovie_mc.alpha = .5;

Step Six

Test your movie by pressing Cmd/Return (PC - Ctrl/Enter). By setting alpha equal to .5, the object's alpha value (transparency) drops to 50%.

More Object Properties

In this example we altered the object's Alpha value. You can also control the Scale, Size, Location, and Visibility. For more information, see topics, Height Property, Location on Stage Property, Rotation Property, Scale Property, Visible Property, and Width Property.

 

Shutterfly 50 Free Prints 160x600