Thumbnails in a row


I use this code to try to create a photo thumbnail slider from an array loaded with the images names. The problem is that I can create one thumbnail with my code as shown, but I get in trouble when I try to make thumbnails of more than one image from the array. How should I work around this?

I want the thumbnails to create a nice row, that I can use in a “infinite image slider”…

regards, henrik

//image array
//the array that holds the images names
imgArray = _root.getCurrentArray();
//the path to the images folder
imgFolder = _root.getCurrentImgFolder();

size = imgArray.length;

//image nr:
imgIndex = 0;

//load first image

//load thumbnail------------------------------------
function loadThumb(){
	// make a movieclip for each of the jpeg's
	mc = this.createEmptyMovieClip("thumbnail",1);
	mc._x = imgIndex*42;
	mc._y = 0;
	// load in the jpeg

// preload the jpeg
this.onEnterFrame = function () {
	// preload the picture
	if (mc.getBytesTotal()>4&&mc.getBytesLoaded()>=mc.getBytesTotal()) {
		//pic has loaded in completely
		mc._width = 50;
		mc._height = 50;
		delete mc.onEnterFrame;