If I have code that looks like this:
public function getNetStreamPublishClientList():Array
{
var ncStreamListResults = new Object()
ncStreamListResults.onResult = function(list:Array)
{
//this needs to be returned from getNetStreamPublishClientList
return list;
}
this.nc.call("getStreamClientIds",
new Responder(ncStreamListResults.onResult),
this.streamName);
}
how can I return the valu开发者_Go百科e of list from getNetStreamPublishClientList
?
use global item for list
It looks like you won't be able to know the value of list
at the point that getNetStreamPublishClientList()
finishes executing.
This is because the nc
object will probably not have finished its work by that time, and in that case the completion handler (currently assigned to be onResult
) won't have been called.
Whatever is waiting on the result of this function, I'd change it to wait for an event. Possibly use a member function to act as the onResult
handler.
精彩评论