Core language features
ActionScript 3.0 has received some changes to its core language structure. These most likely means very little to you, however it means ActionScript 3.0 is faster, smarter and more efficient. As you work through this book you will see these changes such as the way an object can listen for an action.
Example: myButton.addEventListener(“click”, onClick);
ECMAScript for XML (E4X)
ActionScript 3.0 implements ECMAScript for XML (E4X), recently standardized as ECMA-357. E4X offers a natural, fluent set of language constructs for manipulating XML. In contrast to traditional XML-parsing APIs, XML with E4X performs like a native data type of the language. E4X streamlines the development of applications that manipulate XML by drastically reducing the amount of code needed.
Method closures
In ActionScript 2.0, method closures were not aware of the object instance they were called from, this led to unexpected behavior when the method closure was called. ActionScript 3.0 method closures are aware of it object instance which eliminates the unexpected behavior.
Namespaces
Namespaces (public, private, protected) can have the name of the programmers choice and work as custom access specifiers. Namespaces use a Universal Resource Identifier (URI) to avoid collisions, and when working with E4X they are used to represent XML namespaces.
New primitive types
ActionScript 2.0 has a single numeric type, Number, a double-precision, floating point number. ActionScript 3.0 contains the int and uint types. The int type is a 32-bit signed integer that lets ActionScript code take advantage of the fast integer math capabilities of the CPU. The int type is useful for loop counters and variables where integers are used. The uint type is an unsigned, 32-bit integer type that is useful for RGB color values, byte counts, and more.
Run-time exception
One of the biggest parts of Programming is trouble shooting. More often then not, the programmer will type a variable wrong and nothing will work. Therefore, a great part of a programming language’s acceptability is is capabilities at detecting errors. Simply put, ActionScript 3.0 reports more errors then previous versions. This will help the program quickly find the problem spots and repair them.
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.
Regular expressions
ActionScript 3.0 includes native support for regular expressions so that you can quickly search for and manipulate strings. ActionScript 3.0 implements support for regular expressions as they are defined in the ECMAScript edition 3 language specification (ECMA-262).
Sealed classes
In ActionScript 2.0, all classes were dynamic by default. Meaning you could change properties on any variable without errors. In ActionScript 3.0 by default all classes are sealed. in a sealed class one cannot change the properties at will. At compile-time the properties are defined and are not to be changed. This improves memory usage and results in a stronger program. You can however, create a dynamic class with the key word dynamic.
Information courtesy of Adobe Live Docs