# Preloading Bug?

**URL:** <https://forum.kirupa.com/t/preloading-bug/163543>\
**Category:** Uncategorized\
**Created:** [September 23, 2005, 8:12am UTC](https://forum.kirupa.com/t/preloading-bug/163543 "2005-09-23T08:12:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rickface](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@rickface](https://forum.kirupa.com/u/rickface)\
**Post date:** [September 23, 2005, 8:12am UTC](https://forum.kirupa.com/t/preloading-bug/163543/1 "2005-09-23T08:12:59Z")

</div>

Hi kirupaworld!

Been pulling out my hair over a preloader today. These things usually seem to go off without a hitch, but today the tables have turned on me.  
This is my first preloader using setInterval (and its also my first easing preloader).

code looks a little like this:

```auto

var loadingClip:MovieClip = this;
function preLoader(bar:MovieClip,targetClip:MovieClip, targetWidth:Number){
	var percent:Number = targetClip.getBytesLoaded()/targetClip.getBytesTotal();
	var dummy:Number = targetWidth*percent;
	trace(targetClip)
	bar._width += (dummy-bar._width)/4;
	if(bar._width>=targetWidth-1){
		clearInterval(picLoader);
		targetClip.play();
	}
	updateAfterEvent();
}

picLoader = setInterval(preLoader,25, pics.loaderBar, loadingClip , 154);

stop();

```

From my limited experience with setInterval, I have found that being literal is always better than being vague so i tried to be as explicit as possible in my function. The movieClip is 2 frames. The first frame is the preloader and the second frame is a movieClip containing a picture. (I attached the fla just in case).

Troubleshooting this, I found that tracing ‘targetClip’ outputs \_level0, tracing percent (and simulating download) waits till the clip is downloaded and then traces 1. :?

Any ideas on what the glitch may be?  
Thanks very much in advance!

ktz
