Limit your use of abbreviations, but use them consistently. An abbreviation must clearly stand for
only one thing. For example, the abbreviation
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 (
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;
my warthogs = false;
5warthogs = 55;
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
words" on page
75.
Note: Explicitly declare variables with
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
reserved words" on page
For example, do not use the following keywords as variables:
var = "foo";
return = "bar"
interface = 10
TextField = "myTextField";
70
Chapter 3: Using Best Practices
//includes a backslash
//includes a space
//begins with a number
before you use them. Local variables are faster to access.
var
75.
might represent section and second. Make sure
sec
$
). Do not begin variable
"Avoiding reserved
"Avoiding
Need help?
Do you have a question about the FLASH MX 2004-USING ACTIONSCRIPT IN FLASH and is the answer not in the manual?
Questions and answers