Platformer type game problem

I’ve been trying to make a game where you can just jump around and run but theres gravity, and you get faster the longer you press the left or right key. Im having a problem though, I have gravity working but it could be better I think, and the characters supposed to move faster the longer you have right down but even when you don’t have the key down it moves to the right and you can’t stop him. Can anyone help me with this?
CODE:

 
onClipEvent(load){
this._y=350 -this._height/2
var moveright
var jumping
}
onClipEvent(enterFrame){
 if(Key.isDown(Key.UP)){jumping=true}
 if(Key.isDown(Key.UP)){acceleration=15;}
//if up key is pressed jumping is true and acceleration=15
 if(jumping=true){this._y-=acceleration}
 if(jumping=true){acceleration-=1}
 //sends the character up and down by acceleration
//reduces the acceleration by 1 per frame to make gravity
 if (this._y + this._height/2 > 350) {
  this._y = 350 - this._height/2
}}
//stops the movieclip from going out of the screen
//works like ground
onClipEvent(keyUp){moveright=false}
onClipEvent(enterFrame){
 if(moveright=false){sideacceleration=0}
 if(Key.isDown(Key.RIGHT)){moveright=true}
 if(moveright=true){sideacceleration=3}
 if(moveright=true){this._x+=sideacceleration}
 if(moveright=true){sideacceleration+=3}}

Thanks ^^ also tell me if I could make the code work better/ be shorter/ get rid of unneeded code, stuff like that.