Catch error reading image file

The following procedures are part of a class used in reading an image file into a sprite. It works if the URL is correct. But it doesn’t catch errors like a bad url string.

What do I need to change and/or add so that the loadError function is called when needed?

public function readIntoSprite(url:String)
	this.sprite=new Sprite();
	var loader:Loader=new Loader();
	var urlRequest:URLRequest=new URLRequest(url);
	loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadSpriteComplete);
	loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);

private function loadSpriteComplete(event:Event=null)
	this.dispatchEvent(new Event(Event.COMPLETE));

private function loadError(event:IOErrorEvent)
	this.dispatchEvent(new Event(Event.CANCEL));

Thanks in advance.

It appears that openfl.display.Loader sends all its error events through IO_ERROR, but its possible that certain errors from Lime are not bubbling all the way up.

Perhaps this minor fix is related? Could you try changing your Lime install, and see if it makes a difference?