CHAPTER 2
ActionScript 2.0 to 3.0
The ActionScript language has undergone a complete redesign. It is now a more robust, type-
safe, and usable language. This topic provides an overview of changes to the ActionScript
language. For information about using ActionScript 3.0, see Programming ActionScript 3.0.
For a complete reference on using ActionScript 3.0, see the ActionScript 3.0 Language
Reference.
Contents
Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Usability improvements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Classes and packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Using external files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Initializing variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Typing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Global functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Overview
This section lists some of the most common changes that you will encounter when migrating
ActionScript 2.0 to ActionScript 3.0. The remaining sections provide more details about
specific changes in the language.
Most classes are sealed (non-dynamic); as a result, you cannot get or set properties, or call
■
methods, that weren't declared.
Declarations are no longer public by default.
■
You cannot get or set a property, or call a method, on an object reference which is null or
■
undefined.
Method overrides must be marked
■
, and the signature must match exactly.
override
2
21