This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Differences Between Flash ActionScript and Server-Side ActionScript
|
119
Case-Sensitivity
Server-Side ActionScript is always case-sensitive, while client-side ActionScript may
not be. In Flash 5 and Flash MX, most ActionScript is not case-sensitive. For exam-
ple, in Flash MX,
myVariable and MyVariable refer to the same variable. In server-side
scripts, they do not.
Many developers continue to be confused by the case-sensitivity rules in Flash MX
2004, which depend in part on the version (SWF format) and ActionScript version
(compiler version) chosen under File
Publish Settings Flash. Realize first that we
are talking about two different issues for client-side ActionScript: compile-time case-
sensitivity and runtime case-sensitivity. The ActionScript 1.0 compiler is not case-
sensitive, whereas the ActionScript 2.0 compiler is. However, runtime case-sensitiv-
ity is a function of the version of the SWF format to which you export, not the
ActionScript version used at compile time nor the version of the Flash Player plugin
in which the file is played.
Runtime case-sensitivity is summarized in Table 4-1, reproduced from Colin
Moock’s Essential ActionScript 2.0. Note that ActionScript 1.0 and 2.0 are both case-
sensitive when exported in Flash Player 7–format .swf files and played in Flash Player
7. In other runtime cases, code is case-insensitive subject to the exceptions cited in
the footnotes to the table.
a
Identifiers (i.e., variable and property names), function names, frame labels, and symbols export IDs are case-
insensitive in Flash Player 6–format .swf files. But reserved words such as if are case-sensitive, even in Flash
Player 6.
b
Flash Player 6 cannot play Flash Player 7–format .swf files.
Regardless of whether you are writing client-side ActionScript or
SSAS, we strongly recommend maintaining consistent usage of upper-
and lowercase in all your code to avoid problems.
If you are careful to always capitalize names in the same way and never use capitali-
zation to distinguish between variable names or other identifiers, you shouldn’t have
any problems. However, in JavaScript it is a common practice to use capitalization to
distinguish between the name of a constructor function and an instance of a class, as
follows:
function User ( ) {
}
Table 4-1. Runtime case-sensitivity support by language, file format, and Flash Player version
Movie compiled as either
ActionScript 1.0 or 2.0 and
Played in Flash Player 6 Played in Flash Player 7
Flash Player 6format .swf file Case-insensitive
a
Case-insensitive
a
Flash Player 7format .swf file Not supported
b
Case-sensitive

Get Programming Flash Communication Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.