# Losing my mind...please clear my Intervals!

**URL:** <https://forum.kirupa.com/t/losing-my-mind-please-clear-my-intervals/87995>\
**Category:** Uncategorized\
**Created:** [April 25, 2005, 11:11pm UTC](https://forum.kirupa.com/t/losing-my-mind-please-clear-my-intervals/87995 "2005-04-25T23:11:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kdzines](https://avatars.discourse-cdn.com/v4/letter/k/7ea924/32.png) [@kdzines](https://forum.kirupa.com/u/kdzines)\
**Post date:** [April 25, 2005, 11:11pm UTC](https://forum.kirupa.com/t/losing-my-mind-please-clear-my-intervals/87995/1 "2005-04-25T23:11:10Z")

</div>

Hi,

after using setInterval a billion times, i am now having the most unbelievable problems with it!!!

i got some buttons, when clicked they call a daisychain of functions, ending with a loadMovie function:

```auto

function loadInMovie(clickedButt, arrayPos){
	contentMain.detail.detailImage.holderMc.loadMovie(array_clientImage[arrayPos]);
	meMov = setInterval(loadUp, 15);
	}

```

so this triggers:

```auto

function loadUp() {
	contentMain.preloader._alpha = 100;
	var bytesL = contentMain.detail.detailImage.holderMc.getBytesLoaded();
	var bytesT = contentMain.detail.detailImage.holderMc.getBytesTotal();
	var percent = bytesL/bytesT*100;
	if (bytesL>=bytesT && bytesT>4) {
		trace("done loading");
		loaderOff();//function to clear preloader
		clearInterval(meMov);
		} else {
		contentMain.preloader._xscale = percent;
	}
}

```

pretty standard right? Ok so when i click a link, the preloader kicks in and it works fine, calling loadOff() and tracing “done loading”.

if i then press another button same thing.

BUT if i press another button before the current movie has finished loading, the preload bar adjusts and loads the new movie, but when complete, i get an infinite loop of traces and the loaderOff function doesn’t kick in.

so i guess the clearInterval is breaking down, but why? and how to fix?

basically the \*\*\*\* thing breaks down on me!!!

please, any ideas why? i’m losing my mind on this one!
