# Loading thumbs 1 by 1

**URL:** <https://forum.kirupa.com/t/loading-thumbs-1-by-1/295973>\
**Category:** Uncategorized\
**Created:** [September 8, 2009, 8:18am UTC](https://forum.kirupa.com/t/loading-thumbs-1-by-1/295973 "2009-09-08T08:18:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scarlac](https://avatars.discourse-cdn.com/v4/letter/s/e47c2d/32.png) [@scarlac](https://forum.kirupa.com/u/scarlac)\
**Post date:** [September 8, 2009, 8:18am UTC](https://forum.kirupa.com/t/loading-thumbs-1-by-1/295973/1 "2009-09-08T08:18:52Z")

</div>

Hi

I’m trying to make a code to load my thumbs 1 by 1. It should start to load the next thumb, once it’s ready with the previous one.

I’m reading my thumbs out of an xml. It seems like it’s placing them randomly.

Here is what I have so far.  
Can somebody help me out with this.

```auto
var numPics = galleryList.length;

function placeThumbs() {
	var i = 0;
	while (i < numPics) {
		_root.attachMovie("holder", "holderImg"+i, 10+i);
		_root["holderImg"+i].attachMovie("holder", "holder", 10);
		_root["holderImg"+i].holder.loadMovie("pics/" + galleryList*.tmb);
		_root["holderImg"+i]._x = i * 50;
		_root["holderImg"+i].onEnterFrame = function() {
			this.holder.total = this.holder.getBytesTotal();
			this.holder.loaded = this.holder.getBytesLoaded();
			this.holder.percent = Math.floor(this.holder.loaded/this.holder.total);
			imageName.text = "image " + i;
			imagePercent.text = this.holder.percent;
			if (this.holder.total > 5) {
				if (this.holder.loaded >= this.holder.total) {
					delete this.onEnterFrame;
					//more actions
				}
			}
		}
		i++;
	}
}

placeThumbs();

```
