Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 17

Programming actionscript 3.0
Table of Contents

Advertisement

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 information, 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 performs run-time type checking, improving
the system's 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
keyword. All classes
dynamic
in ActionScript 3.0 are sealed by default, but can be declared to be dynamic with the
dynamic
keyword.
Method closures
ActionScript 3.0 enables a method closure to automatically remember its original object
instance. This feature is useful for event handling. In ActionScript 2.0, method closures
would not remember what object instance they were extracted from, leading to unexpected
behavior when the method closure was invoked. The mx.utils.Delegate class was a popular
workaround, but it is no longer needed.
What's new in ActionScript 3.0
17

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents