Whats wrong with the codes?

i am trying to make the character jump up using function

var jumping:Boolean = false;

function playjumps () {
if(jumping){
//jumping codes here
}

Key.addListener(_root.player);
_root.player.onKeyDown = function(){
if(Key.getCode() == Key.UP){
jumping = true;
}else{
jumping = false;
}
}

but for some reason the code doesnt work,can any 1 help me?