Questions about function

1.i want to make the player jump when i press the up arrow, but i want to put it into a function because i want to change the interval of it.i tried a few way,but it doesnt work,anyway idea of how make it?

2.is it possible to make a function on the frame and call it on some movieclip? because it doesnt work for me.