# Dynamic preloader not working

**URL:** https://forum.kirupa.com/t/dynamic-preloader-not-working/252117
**Category:** Uncategorized
**Created:** [February 16, 2008, 4:27am UTC](https://forum.kirupa.com/t/dynamic-preloader-not-working/252117 "2008-02-16T04:27:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![chup](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/chup/32/925_2.png) [@chup](https://forum.kirupa.com/u/chup)
#### Post date: [February 16, 2008, 4:27am UTC](https://forum.kirupa.com/t/dynamic-preloader-not-working/252117/1 "2008-02-16T04:27:13Z")

</div>

Hi all,

i have a dynamic preloader i’m working at that seem to give me problem, here the coding

```auto

loadPage(section,1,10);
//
function loadPage(sectionID, startID, endID) {
	for (i=startID; i<=endID; i++) {
		loadMovie(path+section+"/tn/"+this["myName"+(i-1)], _root["tn"+i].holder);
		//loadTn(_root["tn"+i]._x,_root["tn"+i]._y,i);
		//
		// create preloader
		attachMovie("preloaderSm","preloaderSm"+i,1000001+i);
		this["preloaderSm"+i]._x = _root["tn"+i]._x+32;
		this["preloaderSm"+i]._y = _root["tn"+i]._y+32;
		// run preloader
		this["preloaderSm"+i].createEmptyMovieClip("runLoader",2000001);
		this["preloaderSm"+i].runLoader.onEnterFrame = function() {
			var loadedBB = _root["tn"+i].holder.getBytesLoaded();
			var totalBB = _root["tn"+i].holder.getBytesTotal();
			trace("load "+loadedBB);
			this._parent._parent.preloaderSm.xbar._xscale = 0;
			//
			if (loadedBB>30) {
				preload = (loadedBB/totalBB)*100;
				this._parent._parent.preloaderSm.percentDisplay.text = Math.ceil(preload)+"%";
				this._parent._parent.preloaderSm.xbar._xscale = Math.ceil(preload);
				if (preload>=100) {
					//fade in contents
					_root["tn"+i].holder._alpha = false;
					var tnAlphaIn:Tween = new Tween(_root["tn"+i].holder, "_alpha", Strong.easeOut, 0, 100, 1, true);
					//
					// unload preloader script and mc
					this.unloadMovie();
					this._parent._parent.preloaderSm.unloadMovie();
				}
			} else {
				preload = 0;
			}
		};
	}
}

```

i think on this following line is not working, because when i trace the value, it only give “4”

```auto

var loadedBB = _root["tn"+i].holder.getBytesLoaded();

```

btw, the images is loading, the problem seem to lies on the preloader only, any insight please?
