
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Identifiers
|
397
You should also try to avoid using the keywords listed in Table 15-2. They are not
reserved words for ActionScript in Flash MX, but they may become a part of the lan-
guage in the future, because they are slated for potential use by ECMA-262.
In addition to the formally defined reserved keywords, you should also
avoid using the names of built-in properties, methods, and objects as
identifiers in your code. Doing so overrides the default behavior of the
property, method, or object in question.
The following is a bad idea because the Date variable overrides the built-in construc-
tor of the same name:
Date = new Object(); // Oops! We just disabled the Date() constructor
Now we can no longer create Date objects:
var now = new Date( ); // Sets now to undefined
trace(now); // Displays the empty string, not the current time and date
Identifiers
All variables, functions, and object properties are named with identifiers. Action-
Script identifiers must be composed according to the following rules:
• Identifiers must start with a letter, underscore, or dollar sign (not a number).
• Identifiers cannot be identical to reserved words.
Table 15-1. ActionScript’s reserved words
add
*
*
Flash 4 reserved words that have been deprecated as of Flash 5.
delete ge
*
le
*
onClipEvent this
and
*
do gt
*