Multi preload and loop

Hello all

I’ll ask then show the code that i already have.

What i want to do is loop through an array of items, Each item has an image attached to it. But i only want it to go onto the next item once the image has been loaded fully.

I have this wicked code that was kindly donated of someone off this forum.

Now i know that this is possible as i’ve seen it but i’m not sure how to do it.

Is it possible to adapt the exsiting codes below to perform this task?

this is the code i have at the mo:

step loader:


function createList(array, i, line, width, count, row) {
	//
	if (i == array.length) {
		trace("list created");
		return;
	}
	//
	var spacing:Number = 20.0;
	var y:Number = (i*spacing);
	var name:String = "item"+i+"_mc";
	listLoader_mc.loader_mc.attachMovie("itemList_mc", name, array.length-i);
	//
	listLoader_mc.loader_mc[name].onEnterFrame = function() {
		//
		if (listLoader_mc.loader_mc[name]._currentframe == 2) {
			//
			if (row == count) {
				row = 0;
				line = line+spacing;
				width = 0;
			}
			//
			listLoader_mc.loader_mc[name]._y = line;
			listLoader_mc.loader_mc[name]._x = width;
			//
			listLoader_mc.loader_mc[name].itemArray[0] = new Object();
			for (var e in array*) {
				listLoader_mc.loader_mc[name].itemArray[0][e] = array*[e];
			}
		}
		//
		if (listLoader_mc.loader_mc[name]._currentframe == 3) {
			//if (movieClip[name]._currentframe == movieClip[name]._totalframes) {
			listLoader_mc.loader_mc[name].onEnterFrame = null;
			var nameLength:Number = listLoader_mc.loader_mc[name].nameDark_txt.textWidth;
			createList(array, i+1, line, width+nameLength+1, count, row+1);
		}
	};
}

preloader:


function startPreload(url) {
	imageLoader_mc.image_mc.loadMovie(url);
	attachMovie("preloaderImage_mc", "preloaderImage_mc", 500, {_x:10, _y:55});
	onEnterFrame = preloadContainer;
}
//
function preloadContainer() {
	var loaded:Number = imageLoader_mc.image_mc.getBytesLoaded();
	var total:Number = imageLoader_mc.image_mc.getBytesTotal();
	imageLoader_mc.image_mc.stop();
	imageLoader_mc.image_mc._visible = false;
	if (total>0) {
		var percent = loaded/total;
		preloaderImage_mc.value = percent;
		if (percent == 1) {
			imageLoader_mc.image_mc.play();
			imageLoader_mc.image_mc._visible = true;
			preloaderImage_mc.removeMovieClip();
			delete onEnterFrame;
		}
	}
}