
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Summary
|
389
// Initialize instance before calling Ball constructor. (Otherwise,
// Ball will delete the params object before we get a chance to use it.)
this.setSignature(this.params.signature);
// Invoke Ball class constructor.
super( );
// No need to delete params object, because the Ball constructor does that.
};
/*
* Set Ball as Baseball's superclass.
*/
org.moock.Baseball.prototype = new org.moock.Ball( );
/*
* Associate the Library's baseballSymbol with the Baseball class
*/
Object.registerClass("baseballSymbol", org.moock.Baseball);
/*
* Instance Methods
*/
/*
* Method: Ball.setSignature( )
* Desc: Sets the ball's signature
*
* Params:
* newSig -The ball's new signature
*/
org.moock.Ball.prototype.setSignature = function (newSig) {
this.sig = newSig;
};
#endinitclip
Note that multiple #initclip blocks can share a single order position. For example,
if we create three subclasses of Ball, we can set all of their
#initclip order parame-
ters to 1. All that matters is that the Ball’s
#initclip order is lower than all its sub-
classes.
Summary
Over the course of this chapter, we’ve studied three related but distinct types of
MovieClip subclasses:
• A subclass defined outside of its Library symbol
• A subclass embedded in its Library symbol (inside an
#initclip directive)
• A component,