# setInterval not stopping

**URL:** <https://forum.kirupa.com/t/setinterval-not-stopping/178702>\
**Category:** flash\
**Created:** [February 13, 2006, 4:16pm UTC](https://forum.kirupa.com/t/setinterval-not-stopping/178702 "2006-02-13T16:16:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul\_ferrie](https://avatars.discourse-cdn.com/v4/letter/p/919ad9/32.png) [@paul\_ferrie](https://forum.kirupa.com/u/paul_ferrie)\
**Post date:** [February 13, 2006, 4:16pm UTC](https://forum.kirupa.com/t/setinterval-not-stopping/178702/1 "2006-02-13T16:16:13Z")

</div>

Hi guys.  
I am not sure whats going wrong where but something is because the setInterval continues to run after maxCount has been reached.  
Basiclly it’s a slide show feature.

Hi guys.  
I am not sure whats going wrong where but something is because the setInterval continues to run after maxCount has been reached.  
Basiclly it’s a slide show feature.

```auto

count = 1;
maxCount = _parent.imgCount;
function loadimg (imgNorm) {
 this.attachMovie ("temp_holder", "temp_holder", 1);
 cache_width = this["temp_holder"]._width;
 this["temp_holder"]._x = 1200;
 this["temp_holder"]._y = 0;
 loadMovie (imgNorm, "temp_holder.mc");
 unloadMovie ("holder");
 if (count >=maxCount) {
  // do nothing
 } else {
  slideShow ();
 }
}
function slideShow () {
 var intervalId:Number;
 Duration = 3000;
 function executeCallback () {
  imgNor = "media/front/front" + count + ".jpg";
  loadimg (imgNor);
  if (count >= maxCount) {
   clearInterval (intervalId);
  }
  count++;
 }
 intervalId = setInterval (executeCallback, Duration);
}
slideShow ();

```

I think it my coding. I am not to familiar with setInterval.  
Any help much appreciated

I think it my coding. I am not to familiar with setInterval.  
Any help much appreciated
