Search code examples
phpactionscript-3flashstatus

Flash AS3 monitoring for PHP script load failure?


I am making a Flash+ActionScript3 program that, at a certain point, will save some text to a text file on my server by calling a PHP script. I want to make sure that my program accounts for possible failures of this process.

I've implemented a way for the PHP script to send a status message back to Flash, regarding whether or not the fwrite operation succeeds (see here).

But what about if the PHP script fails to load in the first place? Or if it hangs? (For example, say the user's internet connection is momentarily lost.) What approach can I take in AS3 to check for and handle such scenarios? Any advice or pointers in the right direction would be appreciated. thanks!


Solution

  • Yeah like what london said about IO_ERROR. I still had your project saved on my desktop. You can do something like:

    varLoader.addEventListener(IOErrorEvent.IO_ERROR, onError);
    function onError(evt:IOErrorEvent):void
    {
        trace(evt);
    }
    

    You can test it by disabling your internet connection