# Use of setInterval

**URL:** https://forum.kirupa.com/t/use-of-setinterval/162631
**Category:** Uncategorized
**Created:** [September 14, 2005, 10:42pm UTC](https://forum.kirupa.com/t/use-of-setinterval/162631 "2005-09-14T22:42:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![CayoHueso](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@CayoHueso](https://forum.kirupa.com/u/CayoHueso)
#### Post date: [September 14, 2005, 10:42pm UTC](https://forum.kirupa.com/t/use-of-setinterval/162631/1 "2005-09-14T22:42:01Z")

</div>

Hi everybody,

I have the code below, containing a setInterval. With it I am trying to call a function once, after 7 seconds, and then clear the Interval.

It is not working and the interval keeps calling the function every 7 seconds.

Can anyone tell me if I am missing anything?  
Thanks a lot for your help.

```auto

//
function scaleUpCurves() {
	clearInterval(scaleUpInterval);
	trace("Interval working");
	fvCurve_mc.onEnterFrame = function() {
		this._xscale += 10;
		this._yscale += 10;
		if (this._xscale >= 100 && this._yscale >= 100) {
			this._xscale = 100;
			this._yscale = 100;
		}
		this._x -= 10;
		this._y -= 10;
		if (this._x <= fvX && this._y <= fvY) {
			this._x = fvX;
			this._y = fvY;
			delete this.onEnterFrame;
		}
	};
}
//
//
this.onEnterFrame = function() {
	badCurve_mc._alpha -= 10;
	if (badCurve_mc._alpha <= 0) {
		badCurve_mc._alpha = 0;
		goodCurves_mc._alpha += 10;
		goodCurves_mc._x += 10;
		if (goodCurves_mc._alpha >= 100 && goodCurves_mc._x >= 296) {
			goodCurves_mc._alpha = 100;
			goodCurves_mc._x = 296;
			var scaleUpInterval = setInterval(scaleUpCurves, 7000);
			delete this.onEnterFrame;
		}
	}
};

```
