Naming a variable

A variable's name must follow these rules:

Also, you should not use any element in the ActionScript language as a variable name; doing so can cause syntax errors or unexpected results. For example, if you name a variable String and then try to create a String object using new String(), the new object is undefined.

hello_str = new String();
trace(hello_str.length); // returns 0

String = "hello"; // Giving a variable the same name as a built-in class
hello_str = new String();
trace(hello_str.length); // returns undefined

The ActionScript editor supports code hints for built-in classes and for variables that are based on these classes. If you want Flash to provide code hints for a particular object type that is assigned to a variable, you can strictly type the variable or name the variable using a specific suffix.

For example, suppose you type the following code:

var members:Array = new Array();
members.

As soon as you type the period (.), Flash displays a list of methods and properties available for Array objects. For more information, see Writing code that triggers code hints.