# My Image Loader doesn't work

**URL:** <https://forum.kirupa.com/t/my-image-loader-doesnt-work/279776>\
**Category:** flash\
**Created:** [January 19, 2009, 6:22am UTC](https://forum.kirupa.com/t/my-image-loader-doesnt-work/279776 "2009-01-19T06:22:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DashMasterful](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@DashMasterful](https://forum.kirupa.com/u/DashMasterful)\
**Post date:** [January 19, 2009, 6:22am UTC](https://forum.kirupa.com/t/my-image-loader-doesnt-work/279776/1 "2009-01-19T06:22:18Z")

</div>

So I’m trying to preload some thumbnails for my gallery like so, but somestimes, the loaders stop working and just freeze, I’m preloading a total of 118 thumbnails, I have no idea why it isn’t workin, any ideas?

```auto
 
// this loads five xml files, each contain links to images
for each(var element:String in r.galleryNameXML.*..link){
     urlLoader = new URLLoader();
     urlLoader.addEventListener(Event.COMPLETE,xmlLoaded);
     urlLoader.load(new URLRequest(element));
}
 
private function xmlLoaded(evt:Event):void{
 
     evt.target.removeEventListener(Event.COMPLETE,xmlLoaded);
 
     myXML = XML(evt.target.data);
     imagesToLoad += (myXML.*..Thumb.length()); 
    //continues to add onto the total # of images to load, total == 118 eventually
 
     for each(var element:* in myXML.*..Thumb.@file){ //grabs links to all the thumbnails
 
          myLoader = new Loader();
          myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,imageLoaded);
          myLoader.load(new URLRequest(element)); 
          //cache images so I can load and add to stage later
 
    }
 
}
 
private function imageLoaded(evt:Event):void{ 
   evt.target.removeEventListener(Event.COMPLETE,imageLoaded);
   imagesLoaded += 1; //when i trace imagesLoaded, it usually stops around 85 or so
}

```
