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?
// 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
}