AS inheritance constructor 101

Subclass constructors need arguments

When extending a class whose constuctor got arguments other than “Void”, you need to explicitly call super(args) in its constructor in order to receive all the arguments from the subclasses instantiation.

E.g.,

function ThumbnailAni(url:String, x:Number, y:Number, maskID:String, maskFrmID:String, initAt:MovieClip)
{
super(url, x, y, maskID, maskFrmID, initAt);
}

Subclasses of Movieclips or UIComponents that got metadata from intialized objects don’t need to do this since Inspectable variables will be passed by init obj when attachMovie() is called.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: