FacebookTwitterGoogle+Share

Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.

Sometimes, with Actionscript 3, you get to register event listeners for error events.
Recently, I was attempting to do so for an instance of the flash.display.loader class.

var ldr:Loader = new Loader();
var urlReq:URLRequest = new URLRequest(url);
ldr.addEventListener(IOErrorEvent.IO_ERROR, catchIOError);
ldr.load(urlReq);
...
function catchIOError(event:IOErrorEvent){
    trace("Error caught: "+event.type);
}

To my puzzlement, this did not work at all.

However, if I had actually read the flash.display.Loader class reference, instead of skimming it, I would have seen this:

ioError:IOErrorEvent — Dispatched by the associated LoaderInfo object when an input or output error occurs that causes a load operation to fail.

So anyway, If you encounter the same problem, the key change is:

ldr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, catchIOError);

Comments

  1. k says:

    This is why we should have specialized computer programs designed to comprehend things for us!

You must be logged in to post a comment.