# setInterval problem

**URL:** <https://forum.kirupa.com/t/setinterval-problem/235805>\
**Category:** Uncategorized\
**Created:** [August 14, 2007, 9:29pm UTC](https://forum.kirupa.com/t/setinterval-problem/235805 "2007-08-14T21:29:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gnaws](https://avatars.discourse-cdn.com/v4/letter/g/6a8cbe/32.png) [@Gnaws](https://forum.kirupa.com/u/Gnaws)\
**Post date:** [August 14, 2007, 9:29pm UTC](https://forum.kirupa.com/t/setinterval-problem/235805/1 "2007-08-14T21:29:06Z")

</div>

Everything works in this, except for the “gotoAndStop”. I’m positive the path is correct. I know because this works on Frame 1 but not on Frame 2 (with a different gotoAndStop number of course).

```auto
setInterval(countDown, 1000);
function countDown() {
    sec--;
    if (sec == 0) {
    this.bttn2.gotoAndStop(7);
    gotoAndStop(_currentframe + 1); // gotoAndStop(nextFrame) doesn't work. =[
    }
    trace(sec);
}

```

After more research, I think the reason my setInterval isn’t working on Frame 2, 3, etc. is because I don’t have a clearInterval call. Not exactly sure how to do this.

```auto

clearInterval(countdown);
setInterval(countdown, 1000);
function countdown() {
    trace("this ams frame 2");
    sec--;
    if (sec == 0) {
        bttn2.gotoAndStop(7);
        gotoAndStop(_currentframe+1);
    }
    trace(sec);
}

```

this doesn’t help much.
