# How to move and stop an object using setInterval?

**URL:** <https://forum.kirupa.com/t/how-to-move-and-stop-an-object-using-setinterval/114376>\
**Category:** Uncategorized\
**Created:** [June 28, 2004, 3:13am UTC](https://forum.kirupa.com/t/how-to-move-and-stop-an-object-using-setinterval/114376 "2004-06-28T03:13:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![El\_Bicho](https://avatars.discourse-cdn.com/v4/letter/e/dbc845/32.png) [@El\_Bicho](https://forum.kirupa.com/u/El_Bicho)\
**Post date:** [June 28, 2004, 3:13am UTC](https://forum.kirupa.com/t/how-to-move-and-stop-an-object-using-setinterval/114376/1 "2004-06-28T03:13:51Z")

</div>

I use the letsMove function to move movieclips

```php
MovieClip.prototype.letsMove = function(time, step, limit) {
	countHundred = function (clip) {
		clip._x += step;
		updateAfterEvent();
		if (distance>=limit) {
			clearInterval(move);
		}
		distance += step;
	};
	var move = setInterval(countHundred, time, this);
};
mc1.letsMove(1, .05, 100); 

```

How can I use another setInterval function so, when the movieclip reaches the limit (in this case 100 pixels), it stops, waits for 1 second and starts the letsMove function again?

Thanks
