# Preload external jpg's from XML gallery

**URL:** <https://forum.kirupa.com/t/preload-external-jpgs-from-xml-gallery/83692>\
**Category:** flash\
**Created:** [March 21, 2005, 3:41pm UTC](https://forum.kirupa.com/t/preload-external-jpgs-from-xml-gallery/83692 "2005-03-21T15:41:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcwilde1](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jcwilde1](https://forum.kirupa.com/u/jcwilde1)\
**Post date:** [March 21, 2005, 3:41pm UTC](https://forum.kirupa.com/t/preload-external-jpgs-from-xml-gallery/83692/1 "2005-03-21T15:41:44Z")

</div>

I am trying to create a preloader that will preload the images all at once that are in my XML gallery. I can get it to preload the swf but not the images that are in the /photos folder. This is the gallery, and the photos are named photo1.jpg thru photo5.jpg.

photo\_xml.onLoad = function() {  
gallery\_th.html = true;  
gallery\_th.htmlText = “\<p align=“center”\>\</p\>”;  
Photos\_Gallery(0);  
};  
_global.Photos\_Gallery = function(justdoit) {  
var photos = photo\_xml.firstChild.childNodes;  
var p\_thumbs = photo\_xml.firstChild.attributes.thumbs, p\_photos = photo\_xml.firstChild.attributes.batephotos;  
var i = justdoit;  
for (var l = 0; l\<lines; l++) {  
for (var c = 0; c\<columns && i\<photos.length; c++, i++) {  
var thumb = gallery\_th.createEmptyMovieClip("thumb_"+i, i);  
PhotoAlbum.thumbs.push(t);  
thumb.\_y = l_a\_th;  
thumb.createEmptyMovieClip(“photos”, 1);  
thumb.photos.loadMovie(p\_thumbs+"/"+photos_.attributes.thumb);  
thumb.dimensions = photos\*.attributes;  
thumb.onRelease = function() {  
gallery\_photo.\_parent.Bateman.unloadMovie();  
gallery\_photo.dimensions = this.dimensions;  
gallery\_photo.onEnterFrame = function() {  
this.\_width += (this.dimensions.width-this.\_width)/3;  
this.\_height += (this.dimensions.height-this.\_height)/3;  
gallery\_th.\_x = this.\_x+(this.\_width/2)+5;  
gallery\_th.\_y = this.\_y-(this.\_height/2);  
if (Math.round(this.\_width) == Math.round(this.dimensions.width) && Math.round(this.\_height) == Math.round(this.dimensions.height)) {  
this.\_width = this.dimensions.width;  
this.\_height = this.dimensions.height;  
delete this.onEnterFrame;  
this.\_parent.createEmptyMovieClip(“Bateman”, 1);  
this.\_parent.Bateman.\_x = this.\_x-(this.\_width/2);  
this.\_parent.Bateman.\_y = this.\_y-(this.\_height/2);  
this.\_parent.Bateman.loadMovie(p\_photos+"/"+this.dimensions.gallery\_bw);  
}  
};  
};  
}  
}  
};  
photo\_xml.load(“photos.xml”);  
stop();

Any suggestions, I have tried two tutorials online but didn’t work, my arrays couldn’t find the images i think.  
-Josh
