ActionScript is an object-based language. The entire language is
composed primarily of blueprints, called classes, for different types
of objects. Based on these blueprints you, as the developer,
construct many instances of many types of objects, and each instance
automatically inherits all the characteristics and functionality of
its class. For example, all arrays are members of the
Array class, which defines the
length property as well as the methods
sort( ), etc.)
that all arrays inherit.
Therefore, whenever you are using ActionScript, you are inherently using objects and object-oriented programming. Understanding the inner workings of ActionScript classes and objects puts you well on your way to harnessing the true power of the language. This knowledge enables you to add properties and methods to individual instances (objects) and to the classes they inherit from.
Every class in
prototype property. The
prototype property contains an object from which
all instances of the class inherit properties and methods.
If you add a property or method to a class’s
prototype, all instances of that class
automatically inherit that custom property or method.
Here is an example:
// Add a property to the
Arrayclass. Array.prototype.testProperty = "this is a test property"; // Create a new array. This array inherits, along with all of the other properties // and methods of the
Arrayclass, the custom