Question : event listener for error with loader?

I need to add  a listener for a loader in AS3 that runs a function when the jpg loading doesn't exist.

couldn't find a event.ERROR or the like.

just have what happens when the jpg is found:
imageloader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded_image);
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
// in as2
 
LoadListener.onLoadError = function(targetMC:MovieClip) {
	msgbox ( "Empty!")
	imageLoader.addListener(LoadListener);
	imageLoader.loadClip(base_url+"data/empty.jpg", targetMC);
};
Open in New Window Select All

Answer : event listener for error with loader?

never mind, solved myself.
1:
2:
3:
4:
5:
6:
imageloader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, image_failed);
 
 
function image_failed(e:IOErrorEvent) {
	imageloader.load(new URLRequest("canvas/empty.jpg"))
}
Open in New Window Select All
Random Solutions  
 
programming4us programming4us