# Killing a setInterval

**URL:** <https://forum.kirupa.com/t/killing-a-setinterval/238054>\
**Category:** Uncategorized\
**Created:** [September 6, 2007, 5:53pm UTC](https://forum.kirupa.com/t/killing-a-setinterval/238054 "2007-09-06T17:53:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [September 6, 2007, 5:53pm UTC](https://forum.kirupa.com/t/killing-a-setinterval/238054/1 "2007-09-06T17:53:55Z")

</div>

I have a setInterval with 15 seconds on frame 160, so if the user decides to start from frame 1 on a replay button perhaps… how can i kill the setInterval… because it seems like it kills the setInterval in 5 seconds instead of 15 seconds.

please advice.

here is the code i have on frame 160

```auto

onMouseMove = function () {
 clearInterval(idleInterval);
 idleInterval = setInterval(endAnimation, idleTime*1000);
};
onMouseDown = function () {
 clearInterval(idleInterval);
 idleInterval = setInterval(endAnimation, idleTime*1000);
};
onMouseUp = function () {
 clearInterval(idleInterval);
 idleInterval = setInterval(endAnimation, idleTime*1000);
};

idleInterval = setInterval(endAnimation, 15000);
        if (done == true) {
         clearInterval(idleInterval);
     idleInterval = setInterval(endAnimation(), 15000);
}

```

so how can i clearInterval on my first frame so next time it goes to frame 160 it can start delaying from second 0 to 15.

please help! :ub:
