I seem to be encountering a problem related to the scope of a variable. The first two instances return the correct value, however, when I subscribe to an event (which appears to be functioning properly), it returns this._id as undefined. I have also attempted using MyFunction._id;
var i = 0;
var func = new MyFunction();
func.init();
function MyFunction(i){
this._id = i;
}
MyFunction.prototype.init = function(){
Debugger.log("A : " + this._id); //displays the result of i
this.myTest; //displays the result of i
Event.subscribe("UPDATE", this.myTest);// is undefined
}
MyFunction.prototype.myTest = function(){
Debugger.log("B : " + this._id);
}
Thank you.