Export Library Movie Symbol for ActionScript

Export Library Movie Symbol for ActionScript

Flash CS4 ActionScript 3.0 Tutorial


How to Access Flash Library Symbols with ActionScript



Once you create a Symbol, it is added to the Library. ActionScript can talk to Movie Symbols or Button Symbols.

To make this happen, we must first assign the Symbol a Class Name. Once the Class is defined, we call the Class with ActionScript and assign our new object a unique variable name. There are a few rules about Class naming conventions. For more information, see topic, Class (Naming).

Tutorial Elements

Movie Symbol with name greenOval


Step One

Add a oval object to the workspace with the Oval tool (o key).

Step Two

With the oval selected, press F8 (Modify > Convert to Symbol).

Step Three

In the dialog box, name your symbol GreenOval and choose Movie clip for the symbol type.

Step Four

Delete the original oval object from the stage.

Step Five

Open the Library (Cmd/L (PC - Ctrl/L) and select the new symbol.

Step Six

Choose Properties from the Library pull-down menu.

Step Seven

In the Advanced mode, Linkage section, click Export for ActionScript and a Class Name appears. Class names generally start with a capital letter.

Step Eight

Add a new layer at the top of the stack, named Actions.

Step Nine

Open the ActionScript panel for your keyframe in the Actions layer by Option double-clicking (PC - Alt double-clicking) the keyframe.

Step Ten

Copy/Paste the following code in the ActionScript Panel:

var greenOval_mc = new GreenOval();




Step Eleven

Test your movie by pressing Cmd/Return (PC - Ctrl/Enter).

Dissecting the Code

The first line of the code creates a new GreenOval object with the variable name of greenOval_mc.

The next two lines place the object 50 pixels down from the top and 100 pixels from the left side of the stage. The final line adds the new object to the stage.


Contribute Ad