Glyph = function(mc_ref,class_ref){ this.ref_mc = mc_ref; this.ref_class = new class_ref(); trace(""); trace(":: New Glyph, attaching class "+this.ref_class+" to mc "+mc_ref); this.class.__parentGlyph__ = this; this.class.__resolve = function(){ var meth = arguments.shift(); return this.__parentGlyph__[meth]; } } Glyph.prototype.__resolve = function(methodName){ return function(){ arguments.unshift(this.ref_mc); return this.ref_class[methodName].apply(this.ref_class,arguments); } } /* CODE SAMPLE: BoundingBox = function(){ this.mode = "horizontal"; this.curX = 0; this.curY = 0; this.increment = 5; } BoundingBox.prototype.drawFrame = function(ref,width,height,lineProps){ if(this.mode=="horizontal"){ this.curX+=this.increment; }else{ this.curY+=this.increment; } with(ref){ lineStyle( lineProps.thickness, lineProps.rgb, lineProps.alpha ); moveTo(this.curX-1,this.curY-1); lineTo(this.curX,this.curY); } updateAfterEvent(); if(this.curX >= width && this.mode=="horizontal" && this.increment>0){ this.mode="vertical"; return true; }else if(this.curY >= height && this.mode=="vertical" && this.increment>0){ this.mode = "horizontal"; this.increment*=-1; return true; }else if(this.curX <= 0 && this.mode=="horizontal" && this.increment < 0){ this.mode = "vertical"; return true; }else if(this.curX <= 0 && this.curY <=0 && this.increment < 0){ this.curX = 0; this.curY = 0; this.mode = "horizontal"; this.increment = 5; return false; }else{ return true; } } BoundingBox.prototype.toString = function(){ return "Bounding Box Class"; } BeveledBox = function(){ } BeveledBox.prototype = new BoundingBox(); BeveledBox.prototype.drawFrame = function(ref,width,height,lineProps){ super.drawFrame.apply(this,arguments); with(ref){ lineStyle( lineProps.thickness, lineProps.bevelColor, lineProps.alpha ); moveTo(0,0); lineTo(width,0); moveTo(0,0); lineTo(0,height); } } BeveledBox.prototype.toString = function(){ return "Beveled Box Class"; } myBox = new Glyph(createEmptyMovieClip("tester",1),BoundingBox); test = new TweenEngine(); test.addCommand("drawFrame",myBox,[100,100,{thickness: 10,rgb: 0x000000, alpha: 100}]); test.addCommand("drawFrame",myBox,[100,100,{thickness: 6,rgb: 0x0000FF, alpha: 100}]); test.addCommand("drawFrame",myBox,[100,100,{thickness: 2,rgb: 0xFF0000, alpha: 100}]); test.startEngine(); */