javascript - creating new instances of createjs object returns the same instance every time -


i'm have strange problem. have object extends createjs.container so:

(function() {   var door = function(label, color) {     this.initialize(label, color);   }   var m = door.prototype = new createjs.container(); // inherit container   m.container_initialize = m.initialize;   m.initialize = function() {     console.log(this);   }   window.door = door; }(window)); 

whenever try , create new version of object anywhere, console.log output gives me same object everytime. if this:

var door1 = new door(); var door2 = new door(); 

i console output of:

door {id: 10, _matrix: c, children: array[0], container_initialize: function, initialize: function…} door {id: 10, _matrix: c, children: array[0], container_initialize: function, initialize: function…} 

... both have same id.

i'm not sure have wrong here make happen?

i missing 1 simple line m.initialize method:

this.container_initialize(); 

solved problem!


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -