Flash ActionScript 2.0
ActionScript is the scripting language used by Macromedia Flash. There are two versions of ActionScript: ActionScript 1.0 and ActionScript 2.0.
ActionScript 1.0, the less formal version of ActionScript, is fine for most general purposes and when you want to target an old version of Flash Player. Want to generate some simple interactivity when a user clicks a button? Want to create an application for a mobile device? Go with ActionScript 1.0. But for creating more complex code, ActionScript 2.0 is more appropriate.
ActionScript 2.0 is an object-oriented programming language that supports full class inheritance and all the features that developers demand from a mature language.
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 for Javascript 2.0 (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 is loosely based on 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 (var x = 3; instead of x=3; see variables for more info.) and provides significantly improved compiler errors (error messages).
With ActionScript 2.0, you can create custom classes and extend built-in classes of Flash.
Compiler warnings and errors: The 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.
Key facts about ActionScript 2.0 include the following points:
Migrating to ActionScript 2.0
The first thing to understand about updating ActionScript 1.0 code to ActionScript 2.0 code is that, in many cases, it's not necessary. ActionScript you wrote in earlier versions of Flash continues to work in Flash.
Migrating your code from ActionScript 1.0 to ActionScript 2.0 is beneficial mainly in the following circumstances:
Understanding ActionScript and Flash Player
There are distinctions between Flash Player and ActionScript versions that can
be very important to understand when building Flash applications.
You can compile a Flash document using
ActionScript 1.0 or ActionScript 2.0 to Flash Player 6, 7, or 8, and it will
work correctly. That is because both ActionScript 1.0 and ActionScript
2.0 compile to the same bytecode (the code that the ActionScript interpreter
in Flash Player reads.) However, there are new ActionScript
APIs (functions, classes, properties, and methods) introduced in each new version
of Flash Player.
API defined:
Abbreviation of application program interface, a set of routines, protocols,
and tools for building software applications. A good API makes it easier to
develop a program by providing all the building blocks. A programmer puts the
blocks together.
For example, the loadMovie() method of the MovieClip class works in Flash Player 6, 7, and 8. However, the MovieClipLoader class works only in Flash Player 7 and 8. That means that even though you can use either ActionScript 1.0 or ActionScript 2.0 for any of those player versions, you have to be careful that the APIs you use are supported in the target player version.
Neither ActionScript 1.0 nor
ActionScript 2.0 are case-sensitive. However, Flash
Player 7 and Flash Player 8 are case-sensitive.
That means that regardless of whether or not you use ActionScript 1.0 or 2.0
the variables userName and UserName are the same in Flash Player 6, but they
are different variables in Flash Players 7 and 8.