Class (Naming)

Class (Naming)

Flash CS4 ActionScript 3.0 Tutorial

 

Class Naming Conventions in Flash ActionScript

 

 

The standard naming convention for variables in Flash is Small Camel Case. When naming classes, the convention is similar except the Class Name should start with a capital letter. This convention is called BigCamelCase.

For more information on Small Camel Case, see topic, Variables. In this example we will create a Class by exporting a library Movie Symbol for ActionScript.

Naming a Class

When naming a Class or Library asset using BigCamelCase try to observe these rules:

Capitalize the first letter

No spaces

Use numbers and/or letters

Avoid using any special characters

Character exceptions are ($, _)

Don't use any reserved words (they appear in blue)

Never start a Class with a number

Assign a name that makes sense

Tutorial Elements

Movie Symbol with name BlueCircle

 

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 BlueCircle and choose Movie clip for the symbol type, then press OK.

Step Four

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

Step Five

Choose Properties from the Library pull-down menu.

Step Six

In the Linkage section, click Export for ActionScript and a Class Name is assigned to the object. Class names generally start with a capital letter and follow the BigCamelCase rules listed above.

Controlling Library Symbols with ActionScript

Once you export a library symbol for ActionScript, you need to add scripting in the Actions panel to control the object. For more information, see topic, Export Library Movie Symbol for ActionScript.

 

Stock Photos from 123RF