jeudi 24 septembre 2015

AS3 IOErrorEvent.IO_ERROR event not catching if file doesn't exist

This doesn't make any sense. I'm trying to load a simple text file. If the file name is just "jeffaberle.txt" then it works fine because that file exists in the location specified. However if the name is changed to "jeffaberle2.txt" the code produces an error because this file does not exist on the server.

I want the IOErrorEvent to fire if the file is missing, but it doesn't fire. There's clearly something I'm missing. Any suggestions?


var urlRequest:URLRequest = new URLRequest("" + "?" + Math.random());  // + Math.random()
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
urlLoader.addEventListener(Event.COMPLETE, completeHandler);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);


function completeHandler(e:Event):void {
    if ( == "true") {
    } else {
function ioErrorHandler(e:IOErrorEvent):void {
    trace("ioErrorHandlerJeff: " + e.toString());

Aucun commentaire:

Enregistrer un commentaire