NAVIGATION:

 

SUPPORTERS:

FlashComponents
  Flash Templates
  Flash Gallery
  Flash Slideshow
  Flash Menu
  Flash Design
  Flash Video
  User Interface

 

FOLLOW:

RSS it down! Twitter it up! Facebook it like a fiend!

 

 

 

 


AS1 OOP: Custom Classes with MovieClips
         by senocular  

MovieClip Constructors
When a movieclip symbol is setup to be created as an alternative class instance with Object.registerClass, even though a movieclip instance isn’t created with a call to the constructor function of that class, the constructor function still gets run for that movieclip instance when its made. So don’t pass off your class constructor as useless for classes used to extend movieclip instances. They still get run like any other objects enabling you to define properties etc. as you please. Consider the following example:

EnhancedClip = function(){
this.abilities = "enhanced";
};
EnhancedClip.prototype = new MovieClip();
Object.registerClass("libraryItemA", EnhancedClip);

 
this.attachMovie("libraryItemA", "myEnhanced_mc", 1);
trace(myEnhanced_mc.constructor == EnhancedClip); // traces true
trace(myEnhanced_mc.abilities); // traces "enhanced"

(Note that super wasn’t used, and isn’t needed, to add default movieclip properties to the movieclip instance created. Setting up the inheritance with class.prototype = new MovieClip() is all you need to take care of that).

 

Prev Page
 
SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components Flash effects. Art without coding.
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Citrus Engine: Flash platformer and sidescrolling game engine
Learn how to advertise on kirupa.com

cdn
content delivery network (cdn)