Search tutorials
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. |
Download (0 kb) |
» Forums |
More help? Search our boards for quick answers! |