# What to use in place of delete this.onEnterFrame?

**URL:** https://forum.kirupa.com/t/what-to-use-in-place-of-delete-this-onenterframe/85523
**Category:** Uncategorized
**Created:** [April 5, 2005, 1:42pm UTC](https://forum.kirupa.com/t/what-to-use-in-place-of-delete-this-onenterframe/85523 "2005-04-05T13:42:52Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jillymo](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@jillymo](https://forum.kirupa.com/u/jillymo)
#### Post date: [April 5, 2005, 1:42pm UTC](https://forum.kirupa.com/t/what-to-use-in-place-of-delete-this-onenterframe/85523/1 "2005-04-05T13:42:52Z")

</div>

I have some code which is set to move an mc after a delay of 3 seconds. Problem I am having is when used like this, it of course keeps going because I am not telling it to stop:

```auto
function move(){
	clearInterval(moveInterval);
	_root.bottom.onEnterFrame = function() {
            _root.bottom._y += 5;
}
}
moveinterval =setInterval(move,3000);

```

So, I try using delete onEnterFrame once the clip reaches a y position of 636, but rather than having the smooth transition to this point, it simply jumps to it.

```auto
function move(){
	clearInterval(moveInterval);
	_root.bottom.onEnterFrame = function() {
            _root.bottom._y += 5;
			 if (_root.bottom._y = 636) {
		             delete this.onEnterFrame;
        }
}
}
moveinterval =setInterval(move,3000);

```

So I see that this is obviously killing the movement of the mc

```auto
(_root.bottom._y += 5;)

```

But I am not sure how else to approach keeping the movement going but stopping it once \_y = 636;

I tried this to, with the same result:

```auto
function move(){
	clearInterval(moveInterval);
	_root.bottom.onEnterFrame = function() {
            _root.bottom._y += 5;
			 if (_root.bottom._y = 636) {
				 _root.bottom.stop();
        }
}
}
moveinterval =setInterval(move,3000);

```

I have looked through forums, have not found any answers or even a hint as to how I would handle this.
