The ActionScript language has grown and developed since its introduction several years ago. With each new release of Flash, additional keywords, objects, methods, and other language elements have been added to the language. However, unlike earlier releases of Flash, Flash MX 2004 and Flash MX Professional 2004 introduce several new language elements that implement object-oriented programming in a more standard way than before. Because these language elements represent a significant enhancement to the core ActionScript language, they represent a new version of ActionScript: ActionScript 2.0.
ActionScript 2.0 is not a new language. Rather, it comprises a core set of language elements that make it easier to develop object-oriented programs. With the introduction of keywords such as class, interface, extends, and implements, ActionScript syntax is now easier to learn for programmers who are familiar with other languages. New programmers can learn more standard terminology that they can apply to other object-oriented languages they might study in the future.
The object-oriented programming (OOP) features in ActionScript 2.0 are based on the ECMAScript 4 Draft Proposal currently in development by ECMA TC39-TG1 (see www.mozilla.org/js/language/es4/index.html). Because the ECMA-4 proposal is not yet a standard, and because it is still changing, ActionScript 2.0 does not conform exactly to this specification.
ActionScript 2.0 supports all the standard elements of the ActionScript language; it lets you write scripts that more closely adhere to standards used in other object-oriented languages, such as Java. ActionScript 2.0 should be of interest primarily to intermediate or advanced Flash developers who are building applications that require the implementation of classes and subclasses. ActionScript 2.0 also lets you declare the object type of a variable when you create it (see Strict data typing) and provides significantly improved compiler errors (see Error Messages).
The following list shows the language elements that are new in ActionScript 2.0:
Key facts about ActionScript 2.0 include the following points:
import command); you can import packages (collections of class files in a directory) by using wildcards.
Caution: The default publish setting for new files created in Flash MX 2004 is ActionScript 2.0. If you plan to modify an existing FLA file to use ActionScript 2.0 syntax, ensure that the FLA file specifies ActionScript 2.0 in its publish settings. If it does not, your file will compile incorrectly, although Flash will not generate compiler errors.
For more information on using ActionScript 2.0 to write object-oriented programs in Flash, see Creating Custom Classes with ActionScript 2.0.
Although using ActionScript 2.0 is recommended, you can continue to use ActionScript 1 syntax, especially if you are doing more traditional Flash work such as simple animation that doesn't require user interaction.
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00000754.html