Hi,Did you guys know that ActionScript(AS)2.0 is completly object oriented? ha ha.. Just joking..
But for guys who are new to AS2.0 keep in mind that AS 2.0 is Object Oriented and it gives you much much breathing space as a programmer.Reusability now will have more meaning,you reuse a class you created in AS2.0 by inheriting the functionality of that class in other classes, the fundamental metaphors of OOP mirrors closly the natural world which would realy help you in the design process .
The simplest way of making a class in AS2.0 is like this
take your fav: editor and type in
//---------------------------------------------------------//
class myColor{
public var myStatus:String;
// this is a public function and returns a String value::
public function checkStatus:String(){
myStatus = "cool";
return(myStatus);
}
}
//----------------------------------------------------------//
Now things that are new to AS 2.0::
All class files should be external .as files.
while naming ur as files keep the file name and the class name the same, might not be new if you were using JAVA.
keep the file along with your .fla or flash applications class folder.
so here the file name will be "myColor.as"
In your flash you write
//-----------------------------------------------------------//
var statusChk:myColor = new myColor();
trace(statusChk.checkStatus());
//-----------------------------------------------------------//
and thats it you are into the track :)
For more information tutorials and goodies clickActionScript Learning Guide from Macromedia
If thats not enough and to know more about AS2.0 Click here
Tuesday, July 20, 2004
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment