ns.onStatus , scope, and this
I am little confuse on how to use 'this' and scope issue when working on FMS and onStatus (just confuse in general).
In the example below I have a function that gets a bunch of calls and I need to track the status of the stream. Since ns.onStatus is a async callback I how do make sure I update the right nsArray[] with the status. I may be over working this but I need some help.
LM.prototype.nsStartit =function(clientObj,nc,nsIndex,streamObj,toIP){
var tempNS;
tempNS = nsStream(clientObj,streamObj,nsIndex,nc,toIP);
nsArray[tempNS].ns = new NetStream(nc);
nsArray[tempNS].ns.attach(streamObj);
nsArray[tempNS].Stat = false;
nsArray[tempNS].ns.onStatus = function (info) {
if ((info.code) == "NetStream.Publish.Start") {
nsArray[tempNS].Stat = true; // Is this the way
nsArray[this.tempNS].Stat = true; // or is this way
// and would I also need tto do the same for var that
// I pass via prarm like 'toIP'
// would I ref 'this.toIP' or just 'toIP'
}
}
nsArray[tempNS].ns.publish(streamObj.name, "live");
}
