# How to stop a function

**URL:** https://forum.kirupa.com/t/how-to-stop-a-function/126155
**Category:** Uncategorized
**Created:** [October 20, 2004, 8:38pm UTC](https://forum.kirupa.com/t/how-to-stop-a-function/126155 "2004-10-20T20:38:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pl\_031](https://avatars.discourse-cdn.com/v4/letter/p/bc79bd/32.png) [@pl\_031](https://forum.kirupa.com/u/pl_031)
#### Post date: [October 20, 2004, 8:38pm UTC](https://forum.kirupa.com/t/how-to-stop-a-function/126155/1 "2004-10-20T20:38:55Z")

</div>

I want to know how to stop a function.  
example:

```auto
 _root.onEnterFrame = function() { 
move();
}
 
function move() {
if (Key.isDown(Key.UP)) {
hero._y -= speed;
}
}

```

How can i stop the function if the hero is dead and i don’t want him to move ?
