Catching server timeout errors when using Flash Remoting
When calling remote services / methods via Flash Remoting, any errors that occur will trigger the onStatus method to be called:
onStatus = function(error){
trace("Error : " + error.description);
}
However, if Flash cannot connect to the server (network or server is down) onStatus will not be called. Using XML and LoadVars you have to manually keep a timer in order to time out the connection, however you do not have to do this using Flash Remoting. Just create a method like the following:
_global.System.onStatus = function(info){
trace("details : " + info.details);
trace("description : " + info.description);
trace("code : " + info.code);
trace("level : " + info.level);
}
This method will be called if Flash MX cannot connect to the Flash Remoting server.
Here is an example output (when the server is not running):
details: http://localhost:8500/flashservices/gateway/
description: HTTP: Failed
code: NetConnection.Call.Failed
level: error
Couple of notes :
- The exact messages may depend on the browser.
- This will only works when connecting to the server via Flash Remoting. It will not work when using the XML or LoadVars object.