User Guide
70 Chapter 3: Using Best Practices
Limit your use of abbreviations, but use them consistently. An abbreviation must clearly stand for
only one thing. For example, the abbreviation
sec might represent section and second. Make sure
you use it only for one term, and choose a different abbreviation for the other term.
Many developers concatenate words to create names. Use mixed casing when you concatenate
words to distinguish between each word for readability. For example, write myPelican rather than
mypelican.
Consider your own naming conventions that are easy to remember, and adapt them for situations
where you have common operations you are using. For more information on naming conventions
and guidelines, see the following topics:
• “Variable names” on page 70
• “Constants” on page 72
• “Functions” on page 72
• “Methods” on page 72
• “Loops” on page 72
• “Classes and objects” on page 73
• “Packages” on page 73
• “Interfaces” on page 74
• “Components and linkage” on page 74
Variable names
Variable names can only contain letters, numbers, and dollar signs (
$). Do not begin variable
names with numbers. Variables must be unique and they are case-sensitive in Flash Player 7 and
earlier. For example, avoid the following variable names:
my/warthog = true; //includes a backslash
my warthogs = false; //includes a space
5warthogs = 55; //begins with a number
Do not use words that are part of the ActionScript language as variable names. In particular, never
use keywords as instance names. For a list of keywords you should not use, see “Avoiding reserved
words” on page 75.
Note: Explicitly declare variables with var before you use them. Local variables are faster to access.
Avoid using variables that are parts of common programming constructs, even if Flash Player does
not include or support the constructs. Because ActionScript is ECMAScript-compliant,
application authors can use current ECMA specifications and proposals for information about
language structure. For a complete list of reserved or commonly used words, see “Avoiding
reserved words” on page 75.
For example, do not use the following keywords as variables:
var = "foo";
return = "bar"
interface = 10
TextField = "myTextField";