PDA

View Full Version : IOErrorEvent.IO_ERROR doesn't fire online



watcher
October 29th, 2008, 08:04 PM
Wow! i can't actually believe nobody posted this (i must have made a mistake myself somewhere).

The problem is, when i am using Loader for loading pictures, and then if i supply bad url and i wanna catch that, so i use IOErrorEvent.IO_ERROR on myLoader.contentLoaderInfo object, then the IOErrorEvent DOES NOT TRIGGER ONLINE! [woot?]
IT DOES, however, TRIGGER when tested OFFLINE (from within flash IDE publish).

Here is the code i am using:


// misspelling on purpose,
// correct image name is 'image.jpg'
var _content:String = "imagge.jpg";
var _loader:Loader;

// load external content
var request:URLRequest = new URLRequest( _content );
_loader = new Loader( );
_loader.x = 300;
_loader.contentLoaderInfo.addEventListener( Event.COMPLETE, draw );
_loader.contentLoaderInfo.addEventListener( IOErrorEvent.IO_ERROR, onIOError );
_loader.load( request );
addChild( _loader );

_text.appendText( "loading: "+_content+"\n" );

function draw( event:Event ):void {
_text.appendText( "Complete!\n" ); // works well online, if all correct
};

function onIOError( event:IOErrorEvent ):void {
_text.appendText( "IOERROR!\n" ); // does not trigger online (no text appended)
};


HERE (http://www.michalfiala.com/data/help/20081030-IOErrorEvent_not_triggering_online.rar) are the files.
HERE (http://www.michalfiala.com/data/help/preview/IOErrorEvent_not_triggering_online.swf) is online example.

What am i doing wrong? :)

Digitalosophy
October 29th, 2008, 09:59 PM
Maybe this will help

http://www.kirupa.com/forum/showpost.php?p=2112823&postcount=355

watcher
October 29th, 2008, 10:17 PM
Maybe this will help

http://www.kirupa.com/forum/showpost.php?p=2112823&postcount=355

Thanks Digitalosophy, but you kinda just reposted same code i am using :)

Still, thank you for the effort!

To rephrase the problem: i wanna be able to detect "IMAGE_NOT_FOUND" when loading image.

Thanks