# Loading local Image on IOError

**URL:** <https://forum.kirupa.com/t/loading-local-image-on-ioerror/322044>\
**Category:** flash\
**Created:** [May 8, 2011, 9:33pm UTC](https://forum.kirupa.com/t/loading-local-image-on-ioerror/322044 "2011-05-08T21:33:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![as3ohh](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@as3ohh](https://forum.kirupa.com/u/as3ohh)\
**Post date:** [May 8, 2011, 9:33pm UTC](https://forum.kirupa.com/t/loading-local-image-on-ioerror/322044/1 "2011-05-08T21:33:05Z")

</div>

I could use some expert eyes on this. I am trying to figure out the best way to load a local image (teaseFail.png), if a web URL comes up empty.

I thought the IOError would fire the ioMarqErrorListener. But it doesn’t look that way.

So I know I’m doing it all wrong. What is the best/right way to do this?

```auto

function loadImagesForShow(webURL){
    
    preLoader.start();
             
    var urlRequest:URLRequest = new URLRequest(webURL);

    marqLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onMarqProgressStatus);
    marqLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioMarqErrorListener);
    marqLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onMarqCompleteStatus);
    marqLoader.load(urlRequest);

    loadThumbs();

}

function ioMarqErrorListener(e:IOErrorEvent):void
{
    trace("ERROR DETECTED:" + IOErrorEvent + ">>>>>>>");

    var urlRequest:URLRequest = new URLRequest("images/teaseFail.png");

    marqLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onMarqProgressStatus);
    marqLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioMarqErrorListener);
    marqLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onMarqCompleteStatus);
    marqLoader.load(urlRequest);

}

```
