Stop animation

anyone can tell me how to stop the animation when i am not pressing the up key?

i tried using -> if(_root.player.walk == false) then i stop();

but end up the character cant move even when i press the up key. =(

Anyone can help ?

Note*
i can’t take out this portion of code from the character movie clip in frame 1:

trace(“execute 1”);
_root.player._y-=2;

 onEnterframe = function() {
   _root.player._y-=1;
   trace("execute 2");
 }

and i can’t take out this portion of code from the character movie clip in frame 10:

_root.player._y-=2;

Because my teacher told me not to remove it … sigh~