Jumping game

I have built a small fla that has a jumping ball in it. when you hit control it jumps and when you hit left or right the ball goes left or right.
Now I was trying to put this actionscript into the frame:
right = Key.isDown(Key.RIGHT)
left = Key.isDown(Key.LEFT)

and I was putting this actionscript on the ball:
onClipEvent (enterFrame) {
if (right) {
this._x+=5
}
}
onClipEvent(enterFrame) {
if (left) {
this._x-=5
}
}

and I thought It was going to work. But it didn’t. If any one can help me it would be greatly apprecitated.

**EDIT Figured it out