# How to pause an functin with Setinterval and play again?

**URL:** <https://forum.kirupa.com/t/how-to-pause-an-functin-with-setinterval-and-play-again/165322>\
**Category:** Uncategorized\
**Created:** [October 10, 2005, 11:22am UTC](https://forum.kirupa.com/t/how-to-pause-an-functin-with-setinterval-and-play-again/165322 "2005-10-10T11:22:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![keitai](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@keitai](https://forum.kirupa.com/u/keitai)\
**Post date:** [October 10, 2005, 11:22am UTC](https://forum.kirupa.com/t/how-to-pause-an-functin-with-setinterval-and-play-again/165322/1 "2005-10-10T11:22:56Z")

</div>

Little bit stuck here, I call a function changePhoto with setInterval.

Furthermore I got two buttons (pause and play)

Now with pause I just clearInterval and with play I want to start where  
changePhoto has been stopped???

```auto

nav_mc.pause_mc.onRelease = function()
{
	trace("Pause this "+pIndex);	
	clearInterval(playID);
	nav_mc.play_mc._visible =true;
	this._visible = false;
}
nav_mc.play_mc.onRelease = function()
{
	trace("Play this");
	play();
	nav_mc.pause_mc._visible =true;
	this._visible = false;
}
playID = setInterval(this, "changePhoto", 4000, 1);

```
