|Ultrashock Tutorials > Flash MX 2004 > ActionScript 2.0|
With the arrival of Flash MX 2004, Macromedia introduced a new version of the scripting language for Flash - ActionScript 2.0. In this tutorial, we'll go through new language features, the new object-oriented programming model, and see examples of migrating ActionScript 1.0 (from Flash 5 and MX) to ActionScript 2.0.
Before we start on the tutorial, make sure you download the source files and unzip them into your working directory. For abbreviation, you'll see references to ActionScript 1.0 & ActionScript 2.0 as AS1 & AS2.
Why do we need a new version of ActionScript?
Well, if all you're making are simple animations or ads you don't really need a new version of ActionScript,. In fact, many of these projects don't even require ActionScript! If I stop here, this will be a rather short tutorial on what you don't need ActionScript for.
So here we go...
As developers use Flash for building more complex applications, ActionScript 1.0 quickly feels under-powered or over-laboured. For mainstream developers who are used to languages such as Java, C++ or C#, ActionScript 1.0 looks and feels foreign. It requires some mind-bending to overcome the initial learning curve, especially if they're trying to develop object-oriented applications.
Okay, maybe you're not into building applications... Are you developing (or would like to develop) games? How about interactive presentations? The good news is, ActionScript 2.0 offers benefits for these types of development as well.
Don't worry if you're not interested in learning ActionScript 2.0 right away. Flash MX 2004 lets you continue using ActionScript 1.0 if you wish, you just won't be able to take advantage of some of the new features. In fact, under the hood, the compiler turns ActionScript 2.0 code into ActionScript 1.0 equivalent bytecodes. The reason for this unexpected feature is to allow developers to code in AS2 and still compile to Flash Player 6 for backwards compatibility. Macromedia calls ActionScript 2.0 a "syntactic formalization of the prototype chaining method". So, yes, the familiar prototype chain is still there, behind the scenes.
©2003 Ultrashock.com - All rights reserved