# Restarting Interval

**URL:** <https://forum.kirupa.com/t/restarting-interval/268202>\
**Category:** Uncategorized\
**Created:** [August 11, 2008, 10:35am UTC](https://forum.kirupa.com/t/restarting-interval/268202 "2008-08-11T10:35:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patch](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/patch/32/1095_2.png) [@Patch](https://forum.kirupa.com/u/Patch)\
**Post date:** [August 11, 2008, 10:35am UTC](https://forum.kirupa.com/t/restarting-interval/268202/1 "2008-08-11T10:35:52Z")

</div>

hi everyone,

got a bit of a question with setInterval();

My Interval is working. But I have a button so that when you click it, it clearIntervals(); etc. But when you click it again, I need it to restart the interval. Which is not happening…

here is my as:

```auto

btn.onRelease = function() {
	if (pressed == 0) {
		menu.signBtn._visible = true;
		fader(menu,100);
		pressed = 1;
		clearInterval(iid);
		trace("cleared: "+iid);
	} else if (pressed == 1) {
		fader(menu,0);
		menu.signBtn._visible = false;
		pressed = 0;
		var iid = setInterval(this, "image", duration);
		trace("new: "+iid);
	}
};

menu.signBtn.onRelease = function() {
	getURL("../signUp.html", "_blank");
};

var iid = setInterval(this, "image", duration);

```

Now, to me it looks fine, but it won’t re-initiate the setInterval…I’m just not quite sure what to do at the moment…

Any tips and advice would be much appreciated.

Cheers,
