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.

17 Responses to Catching server timeout errors when using Flash Remoting

  1. arshad says:

    Hi when I try to connect to the webservice with “http://localhost/dotnet/dotnet.asmx?wsdl“ , I get an error no such service found.

  2. abhishek says:

    r u sure that service has been deployed at that url.u can check by accessing the same URL from the browser, if the service is deployed u will see the service page

  3. vipul says:

    plz tell me how call a value from user to server , and same as how pass value pass from server to user..??? in java scripy.Plz tell me as soon as possible…thanking you.

  4. casm says:

    Yo !If flash mx tells you that there is no service at url requested, there is no service at that url…..so problem lies i your server setup or service itself…I know that this is not much help, but a good fact…

  5. gustavo says:

    el .fla tiene que estar dentro de un navegador necesariamente?the archive .fla into de browser is necesary?in debug movie no work , no work in opera and safari. In the explorer is OK time Out 60 seg.

  6. Thats great man, i love it.If you are interested you can visit my sites: britney spears nude and also nude celebrities

  7. Noni Juice says:

    Great to have the chance to say that this is a great site. I hope that you have a look at mine, tooBye, Dirk

  8. noni says:

    I am glad that i found a site where i can get the best informations about the macromedia and their produkts. Many greatings from germany

  9. http://www.tupartido.com.ar is 100%flash remoting and amfphp, thank for your script time out…

  10. cms says:

    thank for your script time out. I´ll test this on my server

  11. Noni says:

    Great site that you have opened to all of us. I have learned a lot. Keep up the good work. All the best.

  12. shaun says:

    I’ve tried using this method with my custom classes that involve remoting…I embedded _global.System.onStatus, and it works when i test publish in Flash, but when I open it in the browser, the onStatus seems to be only caught if i export as flash 7, and open it in IE, it did not work with the following:Fire Fox(MAC, PC), Safari, IE(When exported as flash 6), has anyone else hit this problem?thanks

  13. shaun says:

    well…I’ve decided to use a timeout of around seven seconds. I just couldn’t seem to get System.onStatus to work with anything but IE

  14. Grant says:

    This does appear to work in IE but doesn’t work in firefox, any chance its a flash plugin issue when used in firefox ?

  15. chandrasekaran says:

    I integrating flash remoting with Asp.Net ,when my service is in offline flash returning error as Error opening URl .II don’t want to show this error when i work in offline mode ,because i using shared object in offline mode.Could you pls help how to hide this Error opening url error for the offline mode.Contact Id:mailtochandra2000@yahoo.com

  16. chandra says:

    I integrating flash remoting with Asp.Net ,when my service is in offline flash returning error as Error opening URl .II don’t want to show this error when i work in offline mode ,because i using shared object in offline mode.Could you pls help how to hide this Error opening url error for the offline mode.Contact Id:mailtochandra2000@yahoo.com

  17. kusha says:

    hisir , i want to now that cant we trace or save the error “Error opening URL” when it comes in the out put pannel, i am working with .txt file and loading the var from the .txt file but if in the run time there is no text file i want to show the error in a text box please help me with this.thanks