Preloader bug - easing preloader

Hello all,

Im having some weird buggy issues with my preloader and was wondering if anyone can take a look to see if you can see anything that may be causing this :?

The bug is sort of hard to explain. The loader works most of the time, but when someone double clicks on a link to load a section, the loader seems to get stuck in a loop - like i didnt put a stop frame at the end of the timeline :?
I get the same bug when I test the movie in flash and simulate the download at cable modem speeds, but I dont seem to get it at 56k simulated speeds.

Im baffled - can anyone think of what this could be?

the code is as follows:


function preLoader(bar:MovieClip,targetClip:MovieClip){
	var loaded:Number = targetClip.getBytesLoaded();
	var total:Number = targetClip.getBytesTotal();
	var percent:Number = loaded/total;
	var dummy:Number = Stage.height*percent;
	bar._height += (dummy-bar._height)/4;
	if(bar._height>=Stage.height-1){
		clearInterval(preloaderInt);
		targetClip.play();
	}
	updateAfterEvent();
}

preloaderInt = setInterval(preLoader,40, loaderBar, _parent);

Thanks a million in advance!

JTK