ActionScript 2.0 is a restructuring of the ActionScript language that provides several powerful new programming features found in other programming languages, such as Java. ActionScript 2.0 encourages program structures that are reusable, scalable, robust, and maintainable. It also decreases development time by providing users thorough coding assistance and debugging information. ActionScript 2.0 conforms more closely to the ECMA-262 Edition 3 standard (see www.ecma-international.org/publications/standards/Ecma-262.htm). ActionScript 2.0 is available in Macromedia Flash MX 2004 and Macromedia Flash MX Professional 2004.
The main features of ActionScript 2.0 include the following:
Familiar object-oriented programming (OOP) model The primary feature of ActionScript 2.0 is a familiar model for creating object-oriented programs. ActionScript 2.0 implements several object-oriented concepts and keywords such as class, interface, and packages that will be familiar to you if you've programmed with Java.
The OOP model provided by ActionScript 2.0 is a "syntactic formalization" of the prototype chaining method used in previous versions of Macromedia Flash to create objects and establish inheritance. With ActionScript 2.0, you can create custom classes and extend Flash's built-in classes.
Strict data typing ActionScript 2.0 also lets you explicitly specify data types for variables, function parameters, and function return types. For example, the following code declares a variable named userName of type String (a built-in ActionScript data type, or class).
var userName:String = "";
Compiler warnings and errors The previous two features (OOP model and strict data typing) enable the authoring tool and compiler to provide compiler warnings and error messages that help you find bugs in your applications faster than was previously possible in Flash.
When you use ActionScript 2.0, make sure that the publish settings for the FLA file specify ActionScript 2.0. This is the default for files created in Flash MX 2004. However, if you open an older FLA file that uses ActionScript 1 and begin rewriting it in ActionScript 2.0, change the publish settings of the FLA file to ActionScript 2.0. If you don't, your FLA file will not compile correctly, and no errors will be generated.
This section contains code examples that you can use to become familiar with creating classes in ActionScript 2.0. If you're not familiar with ActionScript 2.0 scripting, see ActionScript Basics and Using Best Practices.
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/00001048.html