How to stop a function

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

 _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 ?