Question about collision (walls vs blocks)

I have a collision detection set up for a flash game I’m making, if the main object (spaceship, car…ect) hits the “wall” it will stop. The script looks like this:

if(this.hitTest(_root.wall)){
_y= __;
}

You get the idea. There is a slight problem with this script in that it is very limited. It works fine but I have to change to x and y axis numbers everytime I change the size of the “game area” or “object” that is going to hit the “wall”.
It gets pretty tedious…:bored:

Also the script is all but uselessfor something like a “block” since it has multiple sides; my moving object would instantly teleport to same x or y coordinates regardless if it hit the bottom, top, or side of the block.

Is there a way that I could script that when “person” is stopped by a wall it disables what ever key is being pressed (up,down,left,right)?
Or in the case of a block…when the character jumps and “hits his head” on the block it stops hit upward motion, when he lands on the block it stops his downward motion, when he hits the side it stops his sideways motion…etc.

I am using flash MX 2004 (for OS X) (just incase anyone was wondering) :slight_smile: