# IO\_Error only fires once?

**URL:** <https://forum.kirupa.com/t/io-error-only-fires-once/259643>\
**Category:** flash\
**Created:** [May 7, 2008, 12:48pm UTC](https://forum.kirupa.com/t/io-error-only-fires-once/259643 "2008-05-07T12:48:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![beyond\_cool](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@beyond\_cool](https://forum.kirupa.com/u/beyond_cool)\
**Post date:** [May 7, 2008, 12:48pm UTC](https://forum.kirupa.com/t/io-error-only-fires-once/259643/1 "2008-05-07T12:48:31Z")

</div>

I am trying to build some error-trapping and handling into my code.

I’m loading a series of images from an XML file. I’ve purposely entered a number of bad url’s. When I run this code, only the first IO\_Error event gets caught. The second time the loader gets a bad URL, nothing happens. I mean: nothing happens.

```auto

        private static function loadImage(p_url:String):Loader
        {
            var imageLoader:Loader = new Loader;
            var myRequest:URLRequest = new URLRequest(p_url);

            imageLoader.load (myRequest);
            updateLoadingProgress(0x330000);
            imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
            imageLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, imageLoadError);
            trace ("now loading: " + p_url);
            
            return imageLoader
        }
        
        private static function imageLoadError(evt:Event):void
        {
            trace ("That's not a good cookie");
            getNextImage()
        }
        
        private static function getNextImage():void
        {
            imageIndex++;
            if (imageIndex < imageList.length)
            {
                trace ("incoming");
                // Load the next image
                imageList[imageIndex][1] = loadImage(imageList[imageIndex][0]);
        
            }
            else
            {
                setupDisplay();
            }                
        }

```

What … am I doing wrong?
