|
-
[FIX-ED] Error handling for file not found
Which I thought was going to be really easy. Then I learn the error is probably not the type to be handled by try... catch. Sooooo I try listening for the event, but it doesn't seem to care for my AsyncErrorEvent or how I've done it below with the IOErrorEvent...
Still gives me "Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found."
What am I doing wrong? I looked at the senocular (http://www.senocular.com/flash/tutor...?page=3#errors) tut,and thought it may be something to do with "new Loader()", bit I can't seem to comeup with a way around that. 
Code:
function upHandler_SmallSite(event:MouseEvent):void {
//load the image for this location
var pictLdr:Loader = new Loader();
var pictURL:String = "images/" + aList[array.indexOf(event.target)].@id + ".jpg";
var pictURLReq:URLRequest = new URLRequest(pictURL);
pictLdr.load(pictURLReq);
pictLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);
pictLdr.addEventListener(IOErrorEvent.IO_ERROR, loadIOError);
mcBigInfoBox.mcBigInfo_Image.addChild(pictLdr);
}
// Handler for IO error
function loadIOError(event:IOErrorEvent):void {
trace("ErroR");
}
Last edited by eggler; 09-13-2007 at 02:35 AM.
-
Bearded (M|G)od
pictLdr.addEventListener(IOErrorEvent.IO_ERROR, loadIOError);
needs to be:
pictLdr.contentLoaderInfo.addEventListener(IOError Event.IO_ERROR, loadIOError);
-
Ah.
Thank you!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|