# Pausing a setinterval countdown?

**URL:** https://forum.kirupa.com/t/pausing-a-setinterval-countdown/260549
**Category:** flash
**Created:** [May 16, 2008, 5:33pm UTC](https://forum.kirupa.com/t/pausing-a-setinterval-countdown/260549 "2008-05-16T17:33:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![02simond](https://avatars.discourse-cdn.com/v4/letter/0/f19dbf/32.png) [@02simond](https://forum.kirupa.com/u/02simond)
#### Post date: [May 16, 2008, 5:33pm UTC](https://forum.kirupa.com/t/pausing-a-setinterval-countdown/260549/1 "2008-05-16T17:33:38Z")

</div>

Hi  
I have built a Music Player on my site with a pause function. I have also put a setinterval to make the songs change when they are done. The problem I now realized was that the setinterval timer kept going when I paused the songs. How do I pause the setinterval and then resuming it?

Here is the code that I have on the frames:

```auto
function wait() {               
    nextFrame();
 stopAllSounds();
    clearInterval(myTimer);
}
myTimer = setInterval(wait, 208000);
s2 = new Sound();
s2.attachSound("i_have_you_to_thank");
i=1;
function timeme (){
now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
_root["nowtime"+i] = (Number(hours)*3600)+(Number(minutes)*60)+seconds;
_root.newstarttime = _root["nowtime"+i] - _root.nowtime1;
i++;
}
s2.start();
timeme();

```

Thank you all for the help

---

<div class="post-metadata">

### Author: ![onion](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/onion/32/3349_2.png) [@onion](https://forum.kirupa.com/u/onion)
#### Post date: [May 19, 2008, 9:29pm UTC](https://forum.kirupa.com/t/pausing-a-setinterval-countdown/260549/2 "2008-05-19T21:29:59Z")

</div>

You will have to remove your interval (clearInterval) and then re-create it again when you want to start it again.
