EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 16

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...
16 Chapter 1: What’s New in Flash MX 2004 ActionScript
Unlike the changes mentioned above, the changes listed in the following table (some of which
also improve ECMA compliance) may cause existing scripts to work differently than they did
previously. If you used these features in existing scripts that you want to publish to Flash Player 7,
review the changes to make sure your code still works as intended or to determine whether you
need to rewrite your code. In particular, because
undefined is evaluated differently in certain
cases, you should initialize all variables in scripts that you port to Flash Player 7.
SWF file published for Flash Player 7 SWF file published for earlier versions of
Flash Player
Case sensitivity is supported (variable names that
differ only in capitalization are interpreted as being
different variables). This change also affects files
loaded with
#include and external variables loaded
with
LoadVars.load(). For more information, see
“Case sensitivity” on page 29.
Case sensitivity is not supported (variable
names that differ only in capitalization are
interpreted as being the same variable).
Evaluating
undefined in a numeric context returns
NaN.
myCount +=1;
trace(myCount); // NaN
Evaluating undefined in a numeric context
returns 0.
myCount +=1;
trace(myCount); // 1
When undefined is converted to a string, the result is
undefined.
firstname = "Joan ";
lastname = "Flender";
trace(firstname + middlename + lastname);
// Joan undefinedFlender
When undefined is converted to a string, the
result is "" (an empty string).
firstname = "Joan ";
lastname = "Flender";
trace(firstname + middlename + lastname);
// Joan Flender
When you convert a string to a Boolean value, the
result is
true if the string has a length greater than
zero; the result is
false for an empty string.
When you convert a string to a Boolean value,
the string is first converted to a number; the
result is
true if the number is nonzero, false
otherwise.
When setting the length of an array, only a valid
number string sets the length. For example, "6"
works but " 6" or "6xyz" does not.
my_array=new Array();
my_array[" 6"] ="x";
trace(my_array.length); // 0
my_array["6xyz"] ="x";
trace(my_array.length); // 0
my_array["6"] ="x";
trace(my_array.length); // 7
When setting the length of an array, even a
malformed number string sets the length:
my_array=new Array();
my_array[" 6"] ="x";
trace(my_array.length); // 7
my_array["6xyz"] ="x";
trace(my_array.length); // 7
my_array["6"] ="x";
trace(my_array.length); // 7

Table of Contents

Related product manuals