.shivanshi.
. Home . Share . Share Success . Join Us! .

ActionScript - Code Samples

Class

A class is a definition of methods and properties. Class is a generalisation of properties and methods that an instance of class can have.

Delegate Class This class is used for using multiple events with same name. For example this class can be used for executing different code for the same event fired by different components.
Dynamic Class New properties can be defined for the instance of a dynamic class.

Below is the code for class Person.
//Person.as
class Person
{
	var name:String = "Gaurav";
	static var cat:String = null;
	static var ctr = 0;
	function Person(name)
	{
			name = name;
			ctr++;
			trace(ctr);
	}
	static function category()
	{
		cat = "type"+ctr;
		trace("My category is "+cat)
	}
}                


Code on in the fla:

var p1:Person = new Person();
var p2:Person = new Person();
Person.category();
var p3:Person = new Person();         
Add Favorite
| About Us | Site Map | Privacy Policy | Contact Us |
.shivanshi.