hitTest

Hi / I am working on a maze (shown on the picture) and I want a hitTest function, which stops the red dot, when it hits the walls of the maze.
I did try a simpel: if(mcDot.hitTest(mcMaze)){//code} - but this work for the entire mc and not only the walls.

Hope someone here has some advice on how to go about this…

My script looks like this so far:
var distance:Number = 3;
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.LEFT)) {
mcDot._x = Math.max(mcDot._x-distance, 0);
} else if (Key.isDown(Key.RIGHT)) {
mcDot._x = Math.min(mcDot._x+distance, Stage.width-mcDot._width/2);
} else if (Key.isDown(Key.UP)) {
mcDot._y = Math.max(mcDot._y-distance, 0);
} else if (Key.isDown(Key.DOWN)) {
mcDot._y = Math.min(mcDot._y+distance, Stage.height-mcDot._height/2);
}
};
Key.addListener(keyListener);