# Help preloading all images from xml

**URL:** <https://forum.kirupa.com/t/help-preloading-all-images-from-xml/317917>\
**Category:** flash\
**Created:** [January 5, 2011, 11:38pm UTC](https://forum.kirupa.com/t/help-preloading-all-images-from-xml/317917 "2011-01-05T23:38:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![narfy](https://avatars.discourse-cdn.com/v4/letter/n/9de053/32.png) [@narfy](https://forum.kirupa.com/u/narfy)\
**Post date:** [January 5, 2011, 11:38pm UTC](https://forum.kirupa.com/t/help-preloading-all-images-from-xml/317917/1 "2011-01-05T23:38:08Z")

</div>

I’ve followed the kirupa tutorial for making the xml preloading slideshow. However, I want to preload all the xml images BEFORE the slideshow starts. I’ve cannibalized the preloading code and it seems like it should work…but it doesn’t. so here it is:

```auto
stop();
//////////////////////////////////
function loadXML(loaded){
	if(loaded){
		xmlNode = this.firstChild;
		image = [];
		total = xmlNode.childNodes.length;
		for(i=0; i<total; i++){
			image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
		}
		loadImages();
		gotoAndPlay("autoslide");
	} else {
		content = "file not loaded!";
	}
}

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.load("test.xml");
xmlData.onLoad = loadXML;
picture._alpha = 0;

this.onEnterFrame = function() {
	filesize = picture.getBytesTotal();
	loaded = picture.getBytesLoaded();
}

function loadImage(p) {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
}
}

function loadImages(){
	for(j=0; j<total; j++){
		loadImage(j);
	}
}

```

Please help!
