
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
320
|
Chapter 12: Objects and Classes
* yourSubMethod( ) -Short description
*/
/*
* Class Constructor
*/
_global.com.yourDomain.YourSubClass = function (param1, param2, param3, param4) {
// Invoke superclass constructor.
super(param1, param2);
// Create instance properties.
this.subProp1 = param3; // Short description. Type: state datatype
this.subProp2 = param4; // Short description. Type: state datatype
this.subProp3 = null; // Short description. Type: state datatype
// Initialize object.
// ...initialization code goes here...
// Consider packaging init code into an init( ) method
};
/*
* Establish Inheritance. MUST COME BEFORE METHODS!
*/
com.yourDomain.YourSubClass.prototype = new com.yourDomain.YourClass( );
/*
* Instance Methods
*/
/*
* Method: YourSubClass.yourSubMethod( )
* Desc: Short description.
*
* Params:
* param1 -Short description
*/
com.yourDomain.YourSubClass.prototype.yourSubMethod = function (param1) {
// Method body...
trace("yourSubMethod invoked");
};
Further Topics
The scope of this book precludes an in-depth discussion of the following topics. You
are encouraged to pursue them using the external sources listed.
Custom Events
You may have noticed that you have learned how to create methods and properties,
but not event handlers or listener events. ActionScript