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+"
" );
function draw( event:Event ):void {
_text.appendText( "Complete!
" ); // works well online, if all correct
};
function onIOError( event:IOErrorEvent ):void {
_text.appendText( "IOERROR!
" ); // does not trigger online (no text appended)
};
HERE are the files.
HERE is online example.
What am i doing wrong?