# Again with the thumbnail problems

**URL:** https://forum.kirupa.com/t/again-with-the-thumbnail-problems/211366
**Category:** Uncategorized
**Created:** [December 30, 2006, 6:13pm UTC](https://forum.kirupa.com/t/again-with-the-thumbnail-problems/211366 "2006-12-30T18:13:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![just\_julie](https://avatars.discourse-cdn.com/v4/letter/j/7993a0/32.png) [@just\_julie](https://forum.kirupa.com/u/just_julie)
#### Post date: [December 30, 2006, 6:13pm UTC](https://forum.kirupa.com/t/again-with-the-thumbnail-problems/211366/1 "2006-12-30T18:13:21Z")

</div>

Happy New Year!!!

I’m creating a thumbnail gallery using the kirupa tutoral but with some modifications.  
I’m pretty much done. Except, when I test it online, the thumbnails don’t load in any particular order and the order changes when I reload the page.

Is there a way to govern the order in which my thumbs load??

thanks in advance.

below is my actionscript:

function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
image = [];  
description = [];  
thumbnails = [];  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
image\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
description\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
thumbnails\* = xmlNode.childNodes\*.childNodes[2].firstChild.nodeValue;  
thumbnails\_fn(i);  
}

```
} else {
	content = "file not loaded!";
}

```

}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“beauty.xml”);  
/////////////////////////////////////  
listen = new Object();  
listen.onKeyDown = function() {  
if (Key.getCode() == Key.UP) {  
prevImage();  
} else if (Key.getCode() == Key.DOWN) {  
nextImage();  
}  
};  
Key.addListener(listen);  
previous\_btn.\_visible = false;  
next\_btn.\_visible = false;

previous\_btn.onRelease = function() {  
prevImage();  
};  
next\_btn.onRelease = function() {  
nextImage();  
};  
thumbnails.onPress = function() {  
picture.\_visible = false;  
previous\_btn.\_visible = false;  
next\_btn.\_visible = false;  
};  
/////////////////////////////////////  
p = 0;  
this.onEnterFrame = function() {  
filesize = picture.getBytesTotal();  
loaded = picture.getBytesLoaded();  
preloader.\_visible = true;  
if (loaded != filesize) {  
preloader.preload\_bar.\_xscale = 1500\*loaded/filesize;  
} else {  
preloader.\_visible = false;  
picture.\_x=(Stage.width/2)-(picture.\_width/2);  
if (picture.\_alpha\<100) {  
picture.\_alpha += 10;  
}  
}  
};  
function nextImage() {  
if (p\<(total-1)) {  
p++;  
if (loaded == filesize) {  
picture.\_alpha = 0;  
picture.loadMovie(image[p], 1);  
desc\_txt.text = description[p];  
picture\_num();  
}  
}  
}  
function prevImage() {  
if (p\>0) {  
p–;  
picture.\_alpha = 0;  
picture.loadMovie(image[p], 1);  
desc\_txt.text = description[p];  
picture\_num();  
}

}  
function firstImage() {  
if (loaded == filesize) {  
picture.\_alpha = 0;  
picture.loadMovie(image[0], 1);  
desc\_txt.text = description[0];  
picture\_num();  
}  
}  
function picture\_num() {  
current\_pos = p+1;  
pos\_txt.text = current\_pos+" / "+total;  
}

function thumbNailScroller() {  
// thumbnail code!  
this.createEmptyMovieClip(“tscroller”, 1000);  
scroll\_speed = 10;  
tscroller.onEnterFrame = function() {  
if ((\_root.\_ymouse\>=thumbnail\_mc.\_y) && (\_root.\_ymouse\<=thumbnail\_mc.\_y+thumbnail\_mc.\_height)) {  
if ((\_root.\_xmouse\>=(hit\_right.\_x-40)) && (thumbnail\_mc.hitTest(hit\_right))) {  
thumbnail\_mc.\_x -= scroll\_speed;  
} else if ((\_root.\_xmouse\<=(hit\_left.\_x+40)) && (thumbnail\_mc.hitTest(hit\_left))) {  
thumbnail\_mc.\_x += scroll\_speed;  
}  
} else {  
delete tscroller.onEnterFrame;stop();

```
	}
};

```

}  
function thumbnails\_fn(k) {  
thumbnail\_mc.createEmptyMovieClip(“t”+k, thumbnail\_mc.getNextHighestDepth());  
tlistener = new Object();  
tlistener.onLoadInit = function(target\_mc) {  
target\_mc.\_x = (thumbnail\_mc.\_width+5);  
target\_mc.pictureValue = k;  
target\_mc.onPress = function() {  
p = this.pictureValue-1;  
nextImage();  
thumbnail\_mc.\_visible = true;  
previous\_btn.\_visible = true;  
next\_btn.\_visible = true;  
thumbnails.\_visible = false;

```
		};
    target_mc._alpha = 70;
	target_mc.onRollOver = function() {
		this._alpha = 100;
	};
		target_mc.onRollOut = function() {
		this._alpha = 70;
		thumbNailScroller();
	};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);

```

}
