First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Aditya Sharma aka adit_ya_sharma | Website: http://www.ctoffakes.tk
Most programmers like me who have been thinking of moving on from Actionscript 1.0 to 2.0 better know the new basis of the language, which includes strict data typing and use of classes. In this simple tutorial, I'll give you the basic introduction to classes and a easily understandable example for observing the functioning of it when applied on a MovieClip. Iam assuming that the reader has an 'Intermediate' actionscripting knowledge and fundamental programming concepts (functions, variables etc).

Quick Introduction

Q)What are classes? A)If you have been familiar with OOP languages like C++ or Java, then you might be quite familiar with this term. Classes are body of codes, which are used in a modularized fashion in a program, which enables the reusability of a part of the code. Classes (in AS 2.0 context) always contain a constructor and various function bodies (known here as methods)if required, for either getting a value or returning a value, or both. In AS 2.0 classes are defined in a seperate .as file, which should have the same name as the class, and then an object of the class is made in the .fla actions. Q)What are objects? A)Objects are a reference to the class for which they are defined. The synatax in which they are defined in AS 2.0 in the main frame actions is:-
var objName:className = new className([parameters]);
Now we will see the example and coding...
» Level Intermediate

Added: 2005-10-12
Rating: 7 Votes: 9
» Author
Iam a flash actionscript programmer.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.