EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 797

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Using Flash MX 2004 to create content for Flash Player 4 797
In Flash 4, the escape sequence \n generated a carriage return character (ASCII 13). In Flash 5
and later, to comply with the ECMA-262 standard,
\n generates a line-feed character (ASCII
10). An
\n sequence in Flash 4 FLA files is automatically converted to \r.
The & operator in Flash 4 was used for string addition. In Flash 5 and later, & is the bitwise
AND operator. The string addition operator is now called
add. Any & operators in Flash 4 files
are automatically converted to
add operators.
Many functions in Flash 4 did not require closing parentheses, for example, Get Timer, Set
Variable
, Stop, and Play. To create consistent syntax, the getTimer function and all actions
now require closing parentheses. These parentheses are automatically added during
the conversion.
In Flash 5 and later, when the getProperty function is executed on a movie clip that doesnt
exist, it returns the value
undefined, not 0. The statement undefined == 0 is false in
ActionScript after Flash 4 (in Flash 4,
undefined == 1). In Flash 5 and later, solve this
problem when converting Flash 4 files by introducing
Number() functions in equality
comparisons. In the following example,
Number() forces undefined to be converted to 0 so
the comparison will succeed:
getProperty("clip", _width) == 0
Number(getProperty("clip", _width)) == Number(0)
Note: If you used any Flash 5 or later keywords as variable names in your Flash 4 ActionScript, the
syntax returns an error when you compile it in Flash MX 2004. To solve this problem, rename your
variables in all locations. See “Keywords” on page 33 and “Naming a variable” on page 41.
Using slash syntax
Slash syntax was used in Flash 3 and 4 to indicate the target path of a movie clip or variable. In
slash syntax, slashes are used instead of dots; also, to indicate a variable, you precede it
with a colon:
myMovieClip/childMovieClip:myVariable
To write the same target path in dot syntax (see “Dot syntax” on page 30), which is supported by
Flash Player 5 and later, you would use the following code:
myMovieClip.childMovieClip.myVariable
Slash syntax was most commonly used with the tellTarget action, whose use is also no longer
recommended. The
with action is now preferred over tellTarget because it is more compatible
with dot syntax. For more information, see
tellTarget and with in Chapter 12, “ActionScript
Dictionary,” on page 205.

Table of Contents

Related product manuals