Gravity / falling code?

ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000FF]stop[/COLOR]COLOR=#000000[/COLOR];
speed = [COLOR=#000080]3[/COLOR]
[COLOR=#0000FF]onEnterFrame[/COLOR] = [COLOR=#000000]function[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]if[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]play[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#0000FF]_root[/COLOR].[COLOR=#000080]p1[/COLOR].[COLOR=#0000FF]_x[/COLOR]+=speed
[COLOR=#000000]}[/COLOR]
[COLOR=#0000FF]else[/COLOR] [COLOR=#0000FF]if[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]gotoAndPlay[/COLOR]COLOR=#000000[/COLOR]
[COLOR=#000000]}[/COLOR]

[COLOR=#0000FF]else[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]gotoAndPlay[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000080]24[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR]

[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]

im using that code i made, the running works well, but the jumping (the middle part) doesnt seem to work, im pretty sure there isnt a (Key.isPressed(Key.UP)) so that wont work

i also need a gravity code (which im not very good at) and im currently working on another way of working around this script…

if you need to look at the .fla just ask, if anyone could tell me if anything is wrong with the above code, or give me a better one that would be great :link:

EDIT - i also tried adding sliding but alas that didnt go well…