Invoking movement based on which key is pressed

Hello everyone, I am trying to have the player move smoothly in any direction they choose based on which key they pressed. Right now, I want the player to move left when the ‘a’ key is pressed. I have no clue how to do this. I want a smooth movement with no errors or jerkiness.

All I have is this to get me started:

 if event.keyName == "a" then if event.phase == "down" then local message = "a was pressed" print(message) elseif event.phase == "up" then local message = "a was released" print(message) end end

Any help is appreciated. When this problem is solved, … I have another. Thank you for your support.

Tons of content on the page below. Just Ctrl+F for “Control”.

http://www.tandgapps.co.uk/resources/coronalabs-resources/

So, I figured out how to invoke the character movement, however if you are moving in one direction, let go suddenly, and switch quickly to the other direction there is a slight delay, could anyone explain why? 

Here are the files:

Tons of content on the page below. Just Ctrl+F for “Control”.

http://www.tandgapps.co.uk/resources/coronalabs-resources/

So, I figured out how to invoke the character movement, however if you are moving in one direction, let go suddenly, and switch quickly to the other direction there is a slight delay, could anyone explain why? 

Here are the files: