Movement question

ok im making a pacman type game and i got the key movements down but my question is : how do i make it so that like if u press left, the character keeps moving left until it either hits a wall or the player presses a different key … and by keep going left i mean without u having to hold the left arrow key, just press it once.

for the movement, create two variables in the load section

var movieclip.speedx;
var movieclip.speedy;

then on your enterFrame, put this

movieclip._x+=movieclip.speedx;
movieclip._y+=movieclip.speedy;

and this

if (Key.isDown(Key.UP)){
movieclip.speedy=-5;
movieclip.speedx=0;
}
if (Key.isDown(Key.DOWN)){
movieclip.speedy=5;
movieclip.speedx=0;
}
if (Key.isDown(Key.RIGHT)){
movieclip.speedx=5;
movieclip.speedy=0;
}
if (Key.isDown(Key.LEFT)){
movieclip.speedx=-5;
movieclip.speedy=0;
}