# Loading Images in order

**URL:** <https://forum.kirupa.com/t/loading-images-in-order/80791>\
**Category:** flash\
**Created:** [February 24, 2005, 8:21pm UTC](https://forum.kirupa.com/t/loading-images-in-order/80791 "2005-02-24T20:21:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gumby19](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gumby19](https://forum.kirupa.com/u/Gumby19)\
**Post date:** [February 24, 2005, 8:21pm UTC](https://forum.kirupa.com/t/loading-images-in-order/80791/1 "2005-02-24T20:21:41Z")

</div>

Ok, created an imageviewer using xml. I’m creating thumbnails, using both external swf’s and jpeg’s. My problem is, I want the thumbnails to load in order. For example, all the jpg’s will load faster than the swfs, and it will look like I have blank spots where thumbnails are supposed to be. How can I make sure on is loaded in the for statement before loading the next? For some reason I can’t target it use getBytesLoaded()/Total(). This code is my function to create the thumbnails. Any help is appreciated. You can go to: [http://www.darrenbaldwin.com/work/imageviewer.html](http://www.darrenbaldwin.com/work/imageviewer.html) to see an example of what I’m talking about.

(I’ve also read all the tutorials about xml gallerys and preloading on here, and can’t quite find the answer, but maybe I missed it)

```auto

function createMenu(b) {
	myNum = 0;
	a = viewerXML.childNodes[0].childNodes**.childNodes[1];
	_root.Arrows.removeMovieClip();
	if (a.childNodes.length>5) {
		_root.attachMovie("Arrows", "Arrows", 7);
		_root.Arrows._x = 124.5;
		_root.Arrows._y = 15.8;
	}
	_global.where = a;
	this.createEmptyMovieClip("menu", 8);
	menu._x = 19;
	menu._y = 6;
	menu.setMask(mask);
	for (i=0; i<a.childNodes.length; i++) {
 clip = menu.createEmptyMovieClip(a.childNodes*.childNodes[0].childNodes[0].nodeValue, i);
		clip.createEmptyMovieClip("image", 1);
		clip.image.loadMovie(a.childNodes*.childNodes[1].childNodes[0].nodeValue, i);
		trace(clip.image.getBytesTotal())
		clip.image._xscale = clip.image._yscale=7;
		clip.btn_name.text = a.childNodes*.childNodes[0].childNodes[0].nodeValue;
		clip._x = (clip._width+45)*(i);
		clip.name = a.childNodes*.childNodes[0].childNodes[0].nodeValue;
		clip.imageName = a.childNodes*.childNodes[1].childNodes[0].nodeValue;
		clip.imageDesc = a.childNodes*.childNodes[2].childNodes[0].nodeValue;
		clip.ivar = i;
}
}

```
