Seemingly recursive is not recursive, is the function before the cache
(function () { varButton =function(label, color) { This. Initialize (label, color); }; varp = Button.prototype =NewCreatejs. Container (); P.label; P.background; P.count= 0; P.container_initialize= P.initialize;//this is the function before the cache;P.initialize =function(Label,color) {//redefine this function; This. Container_initialize ();//The previously cached function was called This. Label =label; if(!color) {Color= ' #ccc '; } varText =NewCreatejs. Text (Label, ' 20px Arial ', ' #000 ')); Text.textbaseline= ' Top '; Text.textalign= ' Center '; varwidth = text.getmeasuredwidth () + 30; varHeight = text.getmeasuredheight () + 20; This. Background =NewCreatejs. Shape (); This. Background.graphics.beginFill (color). Drawroundrect (0,0,width,height,10); Text.x= WIDTH/2; Text.y = 10; This. AddChild ( This. background, text); This. On (' click ', This. Handleclick); This. On (' Tick ', This. Handletick); This. Mousechildren =false; }; P.handleclick=function(event) {vartarget =Event.target; Alert (' You clicked on a button: ' +Target.label); }; P.handletick=function(event) {P.alpha= Math.Cos (p.count++*0.1) *0.4+0.6; }; Window. Button=Button;} ());
Seemingly recursive is not recursive, is the function before the cache