![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
Several changes have been implemented in Flash Player 7 to conform more closely to the ECMA-262 Edition 4 proposal (see www.mozilla.org/js/language/es4/index.html). In addition to the class-based programming techniques available in ActionScript 2.0 (see New object-oriented programming model), other features have been added and certain behaviors have changed. Also, when publishing for Flash Player 7 and using ActionScript 2.0, you can cast one object type to another. For more information, see Casting objects. These capabilities don't require you to update existing scripts; however, you may want to use them if you publish your scripts to Flash Player 7 and then continue to revise and enhance them.
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 |
Case sensitivity is not supported (variable names that differ only in capitalization are interpreted as being the same variable). |
Evaluating
|
Evaluating
|
When firstname = "Joan ";
lastname = "Flender";
trace(firstname + middlename + lastname);
// Joan undefinedFlender
|
When firstname = "Joan ";
lastname = "Flender";
trace(firstname + middlename + lastname);
// Joan Flender
|
When you convert a string to a Boolean value, the result is |
When you convert a string to a Boolean value, the string is first converted to a number; 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
|
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
|
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |