Differences between ActionScript 2.0 and ActionScript 3.0

ADMEC Multimedia > Web Development > Differences between ActionScript 2.0 and ActionScript 3.0


In the given below article I have drawn a brief comparison between ActionScript 2.0 and ActionScript 3.0. There are common misperceptions among Web Designers and many Flash Developers that ActionScript 3.0 is much more complicated and tough than the earlier version i.e. ActionScript 2.0 and ActionScript 3.0. It is essential that you must know a little about the progression of ActionScript before you proceed to learn ActionScript 3.0.

Earlier days of ActionScript

The earlier days of ActionScript was based on sequential based programming, then macromedia has introduced a much improved version of that with procedural method of programming, with the requirement of time and ambitiousness of the Adobe latest version introduced Object Oriented Programming structure to do coding in Flash.

Explaining Sequential, Procedural and OOP programming methods in ActionScript

Many of you must be confused about the above terms like Sequential, Procedural, and OOP programming structure. Wait let me clear out all the doubts. Sequential coding was the base of the earlier versions of ActionScript, in this coding process scripting was limited to a linear sequence of instructions telling Flash what to do in a step by step manner. This way of programming was not flexible and did not promote reuse of the code.

As the language advanced, it became a procedural programming language. This code was based on sequential programming structure, but it also follows the step by step set on instructions, but in an advanced and modular manner. This code was able to use again and again without copying and pasting the code multiple times. So, it became the path to follow for the Flash programmers.

The search for advanced ActionScript version finally ended when the latest version i.e. ActionScript 3 was introduced. It is the most modular and evolved method of the code. It has more flexibility than any other earlier versions. This language type has enabled to create programs by the collection of objects. Encapsulation, Prototyping, and Inheritance are some of the great features of the OOPs programming.

Popular misperceptions about ActionScript 3:

Designers and Flash Programmer have many misperceptions about the new version of scripting language. There is a huge group of people who frightened of the newer version of ActionScript i.e. 3.0 as they thought it is quite difficult to learn and very complex, given below are the some of the popular misperceptions about ActionScript3.0:

1. ActionScript 3.0 is only for Object-Oriented Programmers:

Action Script 3 can be used for both class-based, object-oriented programming, as well as timeline-based scripting. You can use it according to your need or purpose.

2. Targeting ActionScript 3 reduces the Flash Player base that you can target

No, I do not agree with this fact. According to the recent survey of Adobe, that gathered 98.6% a record data of the ActionScript 3 compatible Flash Player Version.

3. You can’t write code on the timeline with ActionScript 3

I am using ActionScript 3.0 from last 3 years and never felt this kind of need as I was a OOPs based programmer since ActionScript 1.0. Even if you are not OOPs programmer and you love to work on Procedural code structure. ActionScript 3.0 will give you flexibility to do that in your way.

You can place code on the timeline just as you can with ActionScript 1 and 2.

4. ActionScript 2 development is faster than ActionScript 3

But when professional Flash designers and developers started using the Action scripting 3.0 they found it easier than the earlier versions. I accept that some of the syntaxes required more code than ActionScript 2 but writing explained code helps in debugging and finding errors in ActionScript 3. As latest version has far better debugging and error handling system than ActionScript 2. After the completion of the project you will notice that both versions are consuming almost same duration but latest version offers a better, improved and organized way of writing code.

I have noticed some advantages of the ActionScript 3.0 through my professional working experiences, that new version proves to be much better than earlier versions because of the following reasons:

Advantages of ActionScript 3.0 over 2.0:

1. Stricter Compiler than previous version

I love it; you will also love this feature. I become fan of ActionScript 3.0 because of its strong and stricter compiler behavior. You will notice when you work with this version of ActionScript that it helps you in a genius way. It saves your time. There is no need now to waste your time in finding the complex errors manually. Now advanced compiler will catch all those compile time errors for you

2. ActionScript Virtual Machine (AVM2)

Let me introduce AVM-ActionScript Virtual Machine to you. It works as the master renderer for the SWF files in Flash Player. Previous versions used to render SWF files data using AVM 1 version but ActionScript 3.0 has the new incarnation of the Virtual Machine i.e. AVM 2. It is an excellent renderer it can increase the pace of the file to 10 times more than the AVM 1. So, every flash programmer and designer will love to create light weight, highly optimized and fast running files for the web, AFP (Adobe Flash Player) and Adobe AIR (Adobe Integrated Runtime).

3. AS 3.0 is much faster as compared to AS 2.0

As I discussed earlier about the performance status of AS3 and AS2 above, there are many reasons exist in ActionScript 3.0, those increase the performance of the SWF files. First is advanced OOPs method to code and other one is advanced ActionScript Virtual Machine.

4. AS 3.0 focuses more on OOP as compared to AS 2.0

That’s right; AS 3.0 has more OOP programming than AS 2.0. You can easily create your custom objects, inherit classes, extend sub-super classes, prototype your objects methods now in AS 3 ever than before. So, ActionScript programmer will find ActionScript 3.0 a better option to work on games, data driven applications and API development.

5. Cross platform development is possible in ActionScript 3.0

ActionScript 3.0 is undoubtedly works on all major platform and operating systems. It is a standard language used across the Adobe Flash platform. ActionScript 3.0 works on Flash Player 10, and currently it has great compatibility will all new and old versions too. It works well on the standalone player of adobe i.e. Adobe Air, servers, and products. In future, you can expect that all the features, services and applications from the Adobe will use ActionScript 3. Adobe Flex is the big example for that.

6. Better Syntax writing

The subtle improvements have been unified with syntax writing. Now, new properties do not carry useless underscores, loading data dynamically and linking to an URL has made consistent changes in it.

7. New display architecture using Depth Management Methods

I don’t want to confuse, let me clear out the term “Display Architecture”. This term means how all the contents in the flash file are organized in view of Flash Player as their depth and level. In ActionScript 3.0 Depth Management Methods introduces many methods and properties to deal with the situation. Now, on the fly you can remove, add and replace child or sibling elements in Flash.

8. New event architecture

Event architecture directly related with the consistency of the project. In this version of ActionScript, all the events are fielded by event listeners. The new event model is quite strong than previous one, it allows mouse and keyboard event to propagate through multiple objects in the display list.

9. Improved XML handling through E4X

Now dealing with XML is full of pleasure moment for anyone, than the formerly very unmanaged or cumbersome method. Latest version of AS has introduced ECMA based XML Class to parse data from the XML files. E4X (ECMA for XML) is a more intelligent and excellent approach, as it works in a highly familiar and manageable manner.

10. More text scripting options

The one of the loveliest improvement in top level objects is in Text or String. Now, you can calculate the index of the any letter in first line, last line and under the mouse letters. Calculate length of the specific line or paragraph. These improvements not only make working with the text easier, but also allow a tighter integration with the lines and characters in a filed and their surrounding stage elements.

11. New regular expressions

Want to do form validation go for Regular Expressions. The days have gone when you used to depend on String Object to deal with string or text only. The incarnation of the Regular Expressions is a boon to the text handling in ActionScript 3. Now ActionScript 3 provides a native support for regular expressions. Regular expressions allow us to manipulate text using wild cards, character types (numeric, alpha, punctuation, and so on), white space (spaces, tab, and returns), repeating characters, and more

12. More sound management options

Improvement in Sound Object is one of the most eye catchiest improvements in ActionScript 3. Now, one can control individually or collectively all the sounds as per the need. You can also access amplitude and frequency spectrum data from sounds during playback to create a colorful equalizer on the bases of actual sound.

13. Advanced options to access raw data

This option was not available before. Now, you can access raw binary data at runtime. There are some examples of the same; individual bytes of data can be accessed during download, during sound playback, and during bitmap data manipulation.

14.Manage scope automatically

The scope of accessing data, defining classes or objects, nesting movie clips, parenting symbols is not a big deal in ActionScript 3. The scope will be automatically managed through this version

15. Improved Object Oriented Programming

The great, great and great improvement in ActionScript 3.0 is the improvement inside OOP’s structures. There are few big changes to define or write your classes than previous version. The inclusion of sealed classes and few namespaces are the examples among other things.

I agree that there are many more features to be discussed. But I hope whatever is here, that would be very helpful to know the topic.

Syntax based differences between ActionScript 2 and ActionScript 3

ActionScript started as a sequential programming language, and as the language developed it became a practical programming language.

ActionScript 2.0 is a scripting programming language based on procedural code writing phenomenon and was initially designed for controlling simple 2D vector animations made in Adobe Flash. There were many advanced and new features in ActionScript 2.0 like The class statement – used to create formal classes, The extends keyword – used to establish inheritance, The interface statement – used to create Java-style interfaces, etc. Apart from these features, there were two major improvements that came with ActionScript 2.0: Variable Data Typing and New Class Syntax.

ActionScript 3.0 is an Object Oriented Programming language the latest version of the language used for scripting and programming interactive content for the Adobe Flash Platform. This version has changed the way of scripting on Flash platform. ActionScript 3.0 is very different from ActionScript 2.0 it has come with many new features like Runtime Exceptions, Sealed Classes, Method Closures, New Event Model, E4X Object etc.

Practical differences between ActionScript 2.0 and ActionScript 3.0

Hence, ActionScript 3 is carrying nearly more than 5 times classes and 4 times packages than ActionScript 2. ActionScript 2.0 was launched with 66 classes and 10 packages, while ActionScript 3 has more than 500 classes with 42 packages. This analysis indicates a big difference between two.

Apart from the above theoretical explanation, I am giving some practical examples here. Please read carefully:

1. Declaring typed variables

var s:String = "This is a String";
var i:Number = 5; //Note: Once you type the variable, you can only store data of that type in the variable. For example, the following would throw an error: 
var i:Number = 5; 
s = i;

Because you are trying to store a Number in a variable which you specified was a String. The advantage of typing variables is that, in general, it makes your code a little easier to read, the player can run your code faster, and the compiler can find some errors when you compile your content.

All of the examples given here use typed variables.

2. Creating untyped functions

function foo(bar) {

Note: Unlike in ActionScript 2, in ActionScript 3 if you attempt to call the function without any arguments, you will get an error.

For example, the following would throw an error:

function foo(bar) { 
     trace (bar); 

3. Typed functions;

function foo(bar:String):void { 

Note: We specify the return type as void, which means that the function does not return a value.

Also note that in ActionScript 3 the usage is void, and not Void as in ActionScript 2. If you try to call the function in ActionScript 3 and pass it a Number instead of a String, you will get an error.

4. Random numbers within a range

In AS2.0

var max:Number = 10; 
var randInRange:Number = random(10 + 1); 
trace (randInRange);

In AS3.0

var rand:Number = Math.random(); 
var max:Number = 10; 
var randInRange:Number = Math.round(rand * max); trace(randInRange);

Note: The Math.random and Math.round functions are available in ActionScript 2, but are included here for completeness.

5. _root in ActionScript 3.0

//function on main timeline 
function foo():void { 
//called from anywhere in SWF 

Note: In ActionScript 2 _root always refers to the main timeline of the main SWF. In ActionScript 3, the root property refers to the main timeline of the SWF in which the content originates. In most cases, these will be the same in either version of ActionScript. The main exception is where the property is being called from within a SWF that has been loaded into another SWF. In ActionScript 2 _root will refer to the main timeline of the main SWF (that loaded the other SWF). In ActionScript 3 the root property refers to the main timeline of the loaded SWF (and not the timeline of the SWF which loaded the other SWF).

The root property is only available in Display Object instances (such as MovieClip, Sprite and Button).

6. Handling button interactions

In AS2.

function onButtonRelease():Void { 
     trace("button was clicked"); 

function onButtonRollOver():Void { 
     trace("button was moused over"); 
my_button.onRelease = onButtonRelease;
my_button.onRollOver = onButtonRollOver;

In AS3.0

function onButtonClick(event:MouseEvent):void { 
     trace("button was clicked"); 

function onMouseOver(event:MouseEvent):void { 
     trace("button was moused over"); 
my_button.addEventListener(MouseEvent.CLICK, onButtonClick); 
my_button.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);

Note: Both examples assume there is a button symbol instance named “my_button” on the same timeline as the code.

7. getURL-open an url

In AS2.0

getURL("http://www.adobe.com", "_blank");

In AS3.0

var url:URLRequest = new URLRequest("http://www.adobe.com"); 
navigateToURL(url, "_blank");

8. Keyboard events

In AS2.0

function onKeyDown():Void { 
     var code:Number = Key.getCode(); 
     var char:String = String.fromCharCode(code); 
     trace("Key Down : code : " + code + " char : " + char); 

In AS3.0

function onKeyDownHandler(event:KeyboardEvent):void { 
     var code:uint = event.keyCode; 
     var char:String = String.fromCharCode(code); 
     trace("Key Down : code : " + code + " char : " + char); 
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyDownHandler);

9. attachMovie in ActionScript 3.0

In AS2.0

attachMovie("my_clip", "clip", 10); 
clip._x = 100; 
clip._y = 100; 
clip._alpha = 50;

In AS3.0

var clip:MovieClip = new my_clip(); 
clip.x = 100; 
clip.y = 100; 
clip.alpha = .5; 

Note: In ActionScript 2 the linkage ID, “my_clip” is set in the library for the MovieClip, whereas in ActionScript 3, the class name, “my_clip” is set.

10. API in ActionScript 3.0

Below is a close illustration of the difference between AS2.0 and AS3.0 specifically API. You can see how AS3.0 has given us an approach to build shapes on fly just using a very tiny chunk of code, while AS2.0 requires a massive amount of the same.

In AS2.0

function drawCircle(target_mc:MovieClip, radius:Number, fillColor:Number, fillAlpha:Number) { 
     var x:Number = radius; 
     var y:Number = radius; 
with (target_mc) { 
     beginFill(fillColor, fillAlpha); 
     moveTo(x + radius, y); 
     curveTo(radius + x, Math.tan(Math.PI / 8) * radius + y, Math.sin(Math.PI / 4) * radius + x, Math.sin(Math.PI / 4) * radius + y); 

     curveTo(Math.tan(Math.PI / 8) * radius + x, radius + y, x, radius + y); 
     curveTo(-Math.tan(Math.PI / 8) * radius + x, radius+ y, -Math.sin(Math.PI / 4) * radius + x, Math.sin(Math.PI / 4) * radius + y); 
     curveTo(-radius + x, Math.tan(Math.PI / 8) * radius + y, -radius + x, y); 
     curveTo(-radius + x, -Math.tan(Math.PI / 8) * radius + y, -Math.sin(Math.PI / 4) * radius + x, -Math.sin(Math.PI / 4) * radius + y); 
     curveTo(-Math.tan(Math.PI / 8) * radius + x, -radius + y, x, -radius + y); 
     curveTo(Math.tan(Math.PI / 8) * radius + x, -radius + y, Math.sin(Math.PI / 4) * radius + x, -Math.sin(Math.PI / 4) * radius + y); 
     curveTo(radius + x, -Math.tan(Math.PI / 8) * radius + y, radius + x, y); endFill(); 

createEmptyMovieClip("circle_mc", 10); 
circle_mc._x = 250; 
circle_mc._y = 250; 
drawCircle(circle_mc, 250, 0xFFe0AC, 50);

In AS3.0

var clip:MovieClip = new MovieClip(); 
clip.x = 250; 
clip.y = 250; 
clip.graphics.lineStyle(2, 0xF89950); 
clip.graphics.beginFill(0xFFe0AC, .5); 
clip.graphics.drawCircle(0, 0, 200);

11. Color class

In AS2.0

var clip:MovieClip = attachMovie("circle_clip", "circle_clip", 1); 
clip._x = 100; 
clip._y = 100; 

function onStageClick():Void { 
     var c:Color = new Color(clip); 
     c.setRGB(Math.random() * 0xFFFFFF); 
onMouseUp = onStageClick;

In AS3.0

var clip:MovieClip = new circle_clip(); 
clip.x = 100; 
clip.y = 100; 
function onStageClick(event:MouseEvent):void { 
     var c:ColorTransform = new ColorTransform(); 
     c.color = (Math.random()*0xFFFFFF);    
     clip.transform.colorTransform = c; 
stage.addEventListener(MouseEvent.CLICK, onStageClick);

12. Depth of the MovieClip

In AS2.0

var clip_1:MovieClip = attachMovie("blue_square", "clip_1", 1);
clip_1._x = 100; 
clip_1._y = 100; 
var clip_2:MovieClip = attachMovie("green_square", "clip_2", 2); 
clip_2._x = 115; 
clip_2._y = 115; 

function onStageClick():Void { 
onMouseUp = onStageClick;

In AS3.0

var clip_1:MovieClip = new green_square(); 
clip_1.x = 100; 
clip_1.y = 100; 
var clip_2:MovieClip = new blue_square(); 
clip_2.x = 115; 
clip_2.y = 115; 
stage.addEventListener(MouseEvent.CLICK, onStageClick); 

function onStageClick(event):void { 
     swapChildren(clip_1, clip_2); 

13. Dealing with Sounds

In AS2.0

function onSoundComplete():Void { 
     trace("sound is completed"); 

var my_sound:Sound = new Sound(); 
my_sound.onSoundComplete = onSoundComplete; 

In AS3.0

function onSoundComplete(event:Event):void { 
     trace("sound is completed"); 
var my_sound:Sound = new beep_id(); 
var sTransform:SoundTransform = new SoundTransform(); 
sTransform.volume = .5; 
var channel:SoundChannel = 
channel.soundTransform = sTransform; 
channel.addEventListener(Event.SOUND_COMPLETE, onSoundComplete);

In AS2.0

var sound = new Sound(); 
sound.loadSound("sound.mp3", true);

In AS3.0

var url = new URLRequest("sound.mp3"); 
var sound = new Sound(); 

14. Dynamically content loading

In AS2.0

createEmptyMovieClip("loader", 10); 
loader._x = 100; 
loader._y = 100; 
loader._rotation = 20; 
loader._alpha = 50;

In AS3.0

var request:URLRequest = new URLRequest("image.png"); 
var loader:Loader = new Loader(); 
loader.x = 100;
loader.y = 100;
loader.rotation = 20; 
loader.alpha = .5; 

15. XML and ActionScript 3.0

In AS2.0

function onXMLLoad(success:Boolean):Void { 
    trace(this); trace("Number of Contacts : " + this.firstChild.childNodes[0].childNodes.length); 
     var firstPerson:XMLNode = this.firstChild.childNodes[0].childNodes[0]; 
     var nodes:Array = firstPerson.childNodes; 
     var nodeLen:Number = nodes.length; 
     var node:XMLNode; 
     var favoriteFood:String; 
     for(var i:Number = 0; i < nodeLen; i++) { 
          node = nodes[i]; 
          if(node.nodeName == "favoriteFood") { 
              favoriteFood = node.firstChild.nodeValue; 
     trace("First contact's favorite food : " + favoriteFood); 

var my_xml:XML = new XML();
my_xml.onLoad = onXMLLoad;
my_xml.ignoreWhite = true;

In AS3.0

onXMLLoad(event:Event):void { 
     var xml:XML = new XML(event.target.data); 
     trace("Number of Contacts : " + xml..person.length()); 
     trace("First contact's favorite food : " + xml.contacts.person[0].favoriteFood); 

var loader:URLLoader = new URLLoader(); 
var url:URLRequest = new URLRequest("contacts.xml"); 
loader.addEventListener(Event.COMPLETE, onXMLLoad); 

Note: Both examples use the following XML contained in a file called contacts.xml:

               <name>Mike Chambers</name> 
               <name>John Doe</name> 

Note: in the ActionScript 3 example this in the onXMLLoad function refers to the timeline that contains the code, while in the ActionScript 2 example, this refers to the XML object instance.

16. Video Object

In AS3.0

var videoConnection:NetConnection = new NetConnection(); 

var videoStream:NetStream=new NetStream(videoConnection); 

var metaDataListener:Object = new Object(); 

var video:Video = new Video(); 
video.attachNetStream(videoStream); addChild(video);
video.x=125; video.y=50;

function onMetaData(data:Object):void {              
     playBtn.addEventListener(MouseEvent.CLICK, playVideo);      
     pauseBtn.addEventListener(MouseEvent.CLICK, pauseVideo); 

function playVideo(evt:MouseEvent):void {             

function pauseVideo(evt:MouseEvent):void {             

Note: in the above ActionScript 3 video example you will need two buttons and one video in the same directory where your swf file is stored. In ActionScript2 doesn’t require onMetaData as it handles itself and not throw any error. But in ActionScript 3.0 you strictly specify onMetaData handler to handle the error. Copy and paste above code and follow the instructions given in Note and see the result.

17. Sprite

Sprite is new to AS3 and very similar to a movie clip, but Sprite doesn’t require Timelines. So, Sprite is an appropriate option while we don’t need timeline for the objects. UI components are the best examples, because these components don’t need timelines and can be contained by sprite as child objects.

In AS3.0

import flash.display.Sprite; 
import flash.events.MouseEvent;

var circle:Sprite = new Sprite(); 
circle.graphics.drawCircle(0, 0, 40); 
circle.x = circle.y = 200;

circle.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown2)

function mouseDown2(event:MouseEvent):void {     
circle.addEventListener(MouseEvent.MOUSE_UP, mouseReleased);

18. addChild();

addChild () method registers an object in the display list as a child of DisplayObjectContainer instance. The child is added to the front (top) of all other children in this Display Object Container instance. You can not register a single object as the child of more than one container. If you add an object that is already a child of a object than automatically previous object will de-register its child from the display list.

For example:

Var myObj:Ball = new Ball(); 

Note: here Ball is the base class of the object. You can define base class of any object by pressing F8.

19. Object Oriented Programming- OOPs

The rigorousness of the OOP in ActionScript3 is the point to be noticed. OOP in the AS3 treats differently with the code absolutely. The things you can get away within ActionScript 2, throw error in AS3. It means, you can enhance your productivity using this version as it debug faster that the earlier one.
Here I do not want to write package and classes with the public-private modifiers types of structure, because that can only be discussed only in class-room. There we will discuss about polymorphism, encapsulation, inheritance and prototyping in details.

20. instanceof

In ActionScript 2.0 we have used instanceof for knowing the Booleans of the type of class constructor. But in AS3 it has got replaced to ‘is’ keyword and this keyword is quite stronger for detecting the type of objects.

Basic syntax construction:

In AS2.0

trace (string instanceof class-constructor);

In AS3.0

var mySprite:Sprite = new Sprite(); 
trace(mySprite is Sprite); // true 
trace(mySprite is DisplayObject); // true 
trace(mySprite is IEventDispatcher); // true

21. Timer Class

In AS2.0

AS2 does not have any specific method or class to handle timer related events successfully. In AS2 we use getTimer() method that displays time in milliseconds that have elapsed since the swf file started playing.
Var timer = getTimer();

In AS3.0

Astonishing enhancement for the timer related functions and properties you may notice in this version of Flash script. There is a special Timer class that has its own properties, methods, and events. Unlike AS2 we can control various timer states and trigger your timer on specific time and stop it also.

22. Use of SetInterval and SetTimeout is AS3.0

I assume that you have used SetInterval and SetTimeout functions in AS2. In ActionScript 3.0 the functionality is same but we apply in a different way. For example:  function callFunc(){             trace(“hello”); }  var intId = setInterval(callFunc, 1000);

//to clear interval 
function clerFunc(evt:MouseEvent):void{              
clearBtn.addEventListener(MouseEvent.MOUSE_DOWN, clerFunc);

23. properties of the elements

In ActionScript 3.0 all the properties got changed in AS3 way. That rubbish underscore has removed from the properties and some of them have major changes. See the given below list, here I am giving few properties:

_x = x; 
_y = y; 
_alpha = alpha; 
_rotation = rotation; 
_visible = visible; 
_xmouse = mouseX; 
_ymouse = mouseY; 
Stage.width = stage.stageWidth; 
Stage.height = stage.stageHeight;

And the traditional way of adding numeric values from 0-100 (%) is now 0-1, where .1 means 10, .2 means 20, and so on…

24. Event handling in ActionScript 3.0

This is not a new topic to you now. When you were working with the AS2 version, you handled the events in completely different way. In AS3 event handling and number of events are undeniably diverse. So, the diversification among the events of these two versions also make AS3 event handling a special subject to know. There are three types of events in my knowledge:

  • Mouse Events
  • Keyboard Events
  • Timer Events
  • Frame Events
  • Object Events

I am not explaining in syntax here. You can read that in next posting.

Apart from these events every object or class has its own events for example when we use video class than video component has its own event to control the video in Flash IDE.

Event listeners, event handlers, listener functions, and event handler functions

Event Listeners or Event Handlers are the functions that Flash player execute in response to specific events. We add event listener in two steps. First, we create a function or class method for flash player to execute in response to the event. This function or class method can also call as an event handler function or listener function. And then secondly, with addEventListener () we register that listener function method with the appropriate target of the event.

// Example: Event Listener: 
stage.addEventListener(MouseEvent.MOUSE_UP, onRotateRight); 
function onRotateRight(evt:MouseEvent):void {                

25. Components

ActionScript components are movie clips with parameters that allow you to modify their appearance and behavior on the fly or at the time of working on project. A component can be a simple user interface control, such as a RadioButton or a CheckBox, or it can contain content, such as a List or DataGrid. Components allow you to create robust and consistent Flash application with stunning look and behavior without any hard work.

ActionScript 3.0 components are more suppling, easy to use, and also effortless to skinning. You can not share AS2 or AS3 components, and their behaviors with each other.

Special thanks to Adobe Developer Connect and Rich Shupe with Zevan Rosser.


ActionScript 3.0 is an OOPs based, full of functions, methods, unlimited events, properties, advanced compiler, best performance, and rigorous scripting language for Flash Developers to use. Start switching ActionScript 2.0 right now to ActionScript 3.0.

About Author: Author of this article is Ravi Bhadauria; he is the owner of the multimedia institute at Delhi i.e. ADMEC Multimedia Institute, in India. He has successfully master himself on various technologies and profiles like Graphic Designer, Web Designer, Flash Programmer, SEO Expert, Flex Programmer, PHP Developer, JavaScript and jQuery Designer, Website Usability Expert etc, as he is into this field from last 12 years. He is very fond of writing and reading blogs and articles on the communities and forums. And he teaches all above said advanced applications at his own institute. Contact him by filling the contact us form available at this website.

Want to read on Flex:

Flex is an open source component based object oriented framework. Where we can develop, run, add databases, debug and deploy to the server after creating a bytecode or SWF file. These files can work on all types of operating systems and out of operating systems also with the help of Adobe AIR, a standalone player form adobe.

Leave a Reply

Related Posts

Copy link
Powered by Social Snap