Anyone have any experience with inheritance and createjs. I am trying to extend the createjs.Container class with my button class but I am getting the following error in my browser console. Eveything seems to be working fine which makes me think the problem must be when the page loads. I have played around with the order that I load my scripts but it still produces the error. Below is the structure of my class.
TypeError: this.Container_constructor is not a function
(function() {
function Button(bmp, w, h) {
this.Container_constructor();
this.setup();
}
var p = createjs.extend(Button, createjs.Container);
p.setup = function() {
//code here
} ;
window.Button = createjs.promote(Button, "Container");
}());
After further poking around the problem is actually in my StartBtn class that extends my Button class. This is my working version.
(function() {
function StartButton(bmp, w, h) {
this.Container_constructor();
this.bmp = bmp;
this.width = w;
this.height = h;
this.setup();
}
var p = createjs.extend(StartButton, Button);
window.StartButton = createjs.promote(StartButton, "Button");
}());
Then just instantiate the StartButton and add it to the stage.
this.startBtn = new StartButton(loader.getResult('btn_start'), 227, 50);
this.addChild(this.startBtn)