Hitting a wall

Thats basically my question. How do you get it so that when a movieclip hits a boundry it cant move in that direction? I came up with this:

onClipEvent (enterFrame) {
if (hitTest(_root.wall)) {
_root.guy.movespeed = 0;

But it stopped the movieclip before it even touched the wall, and you could move a short distance if you let go of right/left until you eventually passed the boundry anyway. Any Suggestions?

im no great Expert yet…infact i just started my self. this forum is a great place to learn. i just learned clipping the other day…use something like this

if(this.hitTest(_root.wall)) {
_y -= speed;

for down use this _y -= speed;
for up _y += speed;
for right _x -= speed;
for left _x += speed;

im not to good at explaining things but if you are confused with this i can try fixing your source manually… @.@

What I did in my RPG when the character hits the wall, rather than changing the character speed, I moved it negatively.
Something like:

character._x += character_speed;

And then on the objects that would have hit detection, simply do a movement in the opposite direction:

character._x -= character_speed;
So far, it is working flawlessly for me. I don't ever have to worry about changing the character speed to one thing or another, and since both of the codes can be executed on keyPress, the will work at the same time, thereby nullifying your characters movement.
I think that is what Bahamut was getting at.

thats exactily what i was saying…see i can never be a teacher lol…@.@ oroo