Trap a Loader error and handle it with default
Hello everyone,
I am trying to trap a Loader error and handle with a default image.
There are multiple loaders so I need to catch and fill the one that errors.
Code:
var gell:Loader = new Loader();
addChild(gell);
gell.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorCatcher);
function errorCatcher(e:IOErrorEvent):void{
// This is not working. Have tried both lines.
//gell = Loader(e.target.loader);
var gell:Loader = LoaderInfo(e.target).loader;
gell.load(new URLRequest('blank.jpg'));
}
gell.load(new URLRequest('cat.jpg'));
Any suggestions on this will be greatly helpful.