Moving and hit-tests

Yo,
I need a good way to make a movie clip move in directions when you press the arrow keys and a way to make him not run into walls (the walls will be another movie clip). Need some code and an exlplanation of it.