Hello, all:
 
I am using a Loader to retrieve a jpeg file that may or my not exist. If
it doesn't exist, I'm getting an Actionscript error message:
 
Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never
Completed.
 
I would like to catch this error and handle it gracefully; however I
have not been able to figure out how to catch it. Try/catch doesn't work
(probably because it's an asynchronous process). But I also tried adding
an event listener as follows:
 
function myPictureLoader()
{
  var pictLdr:Loader = new Loader();
  var pictURL:String = "photos/NzPicture.jpg"
  var pictURLReq:URLRequest = new URLRequest(pictURL);
  pictLdr.addEventListener(IOErrorEvent.IO_ERROR, handleIOError);
  pictLdr.load(pictURLReq);         
}  
                                                                        
function handleIOError(event:IOErrorEvent) : void {
  Alert.show('file not found', 'IO error');
}   
        
However the listener function never fires and I still get the
Actionscript error box popping up. Any ideas?
 
TIA,
Robb Cundick

Reply via email to