ADOBE FLEX 3
Developer Guide
5
Advantages of ActionScript 3.0
ActionScript 3.0 goes beyond the scripting capabilities of previous versions of ActionScript. It is designed to facilitate
the creation of highly complex applications with large data sets and object-oriented, reusable code bases. While
ActionScript 3.0 is not required for content that runs in Adobe Flash Player 9 or AIR, it opens the door to perfor-
mance improvements that are only available with the AVM2, the new virtual machine. ActionScript 3.0 code can
execute up to ten times faster than legacy ActionScript code.
The older version of ActionScript Virtual Machine, AVM1, executes ActionScript 1.0 and ActionScript 2.0 code.
AVM1 is supported by Flash Player 9 for backward compatibility with existing and legacy content. For more infor-
mation, see Compatibility with previous versions on page 7.
Whats new in ActionScript 3.0
Although ActionScript 3.0 contains many classes and features that will be familiar to ActionScript programmers,
ActionScript 3.0 is architecturally and conceptually different from previous versions of ActionScript. The enhance-
ments in ActionScript 3.0 include new features of the core language and an improved Flash Player API that provides
increased control of low-level objects.
Note: Adob AIR™ applications can also use the Flash Player APIs.
Core language features
The core language defines the basic building blocks of the programming language, such as statements, expressions,
conditions, loops, and types. ActionScript 3.0 contains many new features that speed up the development process.
Run-time exceptions
ActionScript 3.0 reports more error conditions than previous versions of ActionScript. Run-time exceptions are used
for common error conditions, improving the debugging experience and enabling you to develop applications that
handle errors robustly. Run-time errors can provide stack traces annotated with source file and line number infor-
mation, helping you quickly pinpoint errors.
Run-time types
In ActionScript 2.0, type annotations were primarily a developer aid; at run time, all values were dynamically typed.
In ActionScript 3.0, type information is preserved at run time, and used for a number of purposes. Flash Player 9
and the Adobe AIR runtime perform run-time type checking, improving the systems type safety. Type information
is also used to represent variables in native machine representations, improving performance and reducing memory
usage.
Sealed classes
ActionScript 3.0 introduces the concept of sealed classes. A sealed class possesses only the fixed set of properties and
methods that were defined at compile time; additional properties and methods cannot be added. This enables
stricter compile-time checking, resulting in more robust programs. It also improves memory usage by not requiring
an internal hash table for each object instance. Dynamic classes are also possible using the
dynamic keyword. All
classes in ActionScript 3.0 are sealed by default, but can be declared to be dynamic with the
dynamic keyword.

Get ADOBE® FLEX® 3: PROGRAMMING ACTIONSCRIPT™ 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.