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
cases, you should initialize all variables in scripts that you port to Flash Player 7.
SWF file published for Flash Player 7
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
with
LoadVars.load()
"Case sensitivity" on page
Evaluating
undefined
.
NaN
myCount +=1;
trace(myCount); // NaN
When
undefined
.
undefined
firstname = "Joan ";
lastname = "Flender";
trace(firstname + middlename + lastname);
// Joan undefinedFlender
When you convert a string to a Boolean value, the
result is
if the string has a length greater than
true
zero; the result is
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
16
Chapter 1: What's New in Flash MX 2004 ActionScript
and external variables loaded
. For more information, see
29.
in a numeric context returns
is converted to a string, the result is
for an empty string.
false
is evaluated differently in certain
undefined
SWF file published for earlier versions of
Flash Player
Case sensitivity is not supported (variable
names that differ only in capitalization are
interpreted as being the same variable).
Evaluating
undefined
returns 0.
myCount +=1;
trace(myCount); // 1
When
is converted to a string, the
undefined
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 string is first converted to a number; the
result is
if the number is nonzero,
true
otherwise.
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
in a numeric context
false
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?