(How) is it possible to catch an error thrown in a callback function like onConnect of the XMLSocket object?
var s:XMLSocket = new XMLSocket();
// Will not catch error :-(
try {
s.onConnect = function(succes) {
trace(succes);
throw new Error("Unable to connect");
trace("Won't trace, error thrown");
}
s.connect("127.0.0.1",1024);
}
catch(e:Error) {
trace(e)
}