# Help with setInterval

**URL:** <https://forum.kirupa.com/t/help-with-setinterval/86709>\
**Category:** flash\
**Created:** [April 15, 2005, 12:50am UTC](https://forum.kirupa.com/t/help-with-setinterval/86709 "2005-04-15T00:50:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![East\_High](https://avatars.discourse-cdn.com/v4/letter/e/6de8d8/32.png) [@East\_High](https://forum.kirupa.com/u/East_High)\
**Post date:** [April 15, 2005, 12:50am UTC](https://forum.kirupa.com/t/help-with-setinterval/86709/1 "2005-04-15T00:50:53Z")

</div>

Thanks to Scotty I know how to do a height check with setInterval, but how do you make one to check the \_x and \_y? I would like to use the following code to scale a mc with “onRollOver” and then the mc would scale back onRollOut.

```auto
onClipEvent (load) {
	targetX = 200;
	targetY = 200;
	vx = 0;
	// our current velocity
	// play with these next to values to get desired amount of springyness
	springSpeed = .2;
	// higher values make spring move faster
	springDamp = .8;
	// lower values make more resistance (friction)
	this.onEnterFrame = function() {
		var diffX = targetX-this._xscale;
		var diffY = targetY-this._yscale;
		vx += diffX*springSpeed;
		vx += diffY*springSpeed;
		vx *= springDamp;
		this._xscale += vx;
		this._yscale += vx;
		if (Math.abs(diffX)<1 && Math.abs(diffY)<1 && Math.abs(vx)<.1) {
			this._xscale = targetX;
			this._yscale = targetY;
			vx = 0;
			delete this.onEnterFrame;
		}
	};
}

```

Thanks
