I have declared a class in the following way:
function maskEditor() {
this.init();
};
maskEditor.prototype = {
foo: null,
container: new createjs.Container(),
init:function () {
this.foo = "bar";
this.container.on("mousedown", this.onMouseDown); // This is just an easeljs event dispatcher
},
onMouseDown: function (event) {
alert(this.foo); // WRONG. 'this' is out of the scope :(
}
};
Long story short: Im using easeljs library, and I have declared an event dispatcher to capture mouse clicks. I need to access the maskEditor object from inside that method. How can I do that?