/ Published in: ActionScript
URL: http://mabblog.com/blog/?p=170
Use like this:
createClassMovieClip(CustomClass, “newclip”, getNextHighestDepth(), {x:10, _y:10, something:function(){this.something = 10;}})
Expand |
Embed | Plain Text
/* Description: A function used for creating empty movie clips with subclass association. Parameters: c:Function - The class to associate with the the empty movie clip. name:String - The instance name for the empty movie clip. depth:Number - The depth for the empty movie clip. initOb:Object - Optional, object to copy properties from Returns: MovieClip - A reference to the newly created movie clip. */ MovieClip.prototype.createClassMovieClip = function(c:Function, name:String, depth:Number, initOb:Object) : MovieClip { var mc:MovieClip = this.createEmptyMovieClip(name, depth); mc.__proto__ = c.prototype; mc.constructor = c; if(initOb) { for(var prop in initOb) { mc[prop] = initOb[prop]; } } c.call(mc); return mc; }
You need to login to post a comment.
