hitTest - Left and Right collision detection

So on the Stage I’ve two walls, one named wall_1 and the other wall_2. Along the two walls is a ball.


onClipEvent (load) {
 var ballMove:Object = new Object();
 var speed:Number = 10;
}
onClipEvent (enterFrame) {
 ballMove.onKeyDown = function() {
  switch (Key.getCode()) {
  case Key.LEFT :
   _x -= speed;
   break;
  case Key.RIGHT :
   _x += speed;
   break;
  case Key.UP :
   _y -= speed;
   break;
  case Key.DOWN :
   _y += speed;
  }
 };
 Key.addListener(ballMove);
 trace(this._x)
 if (this.hitTest(_root.wall_1) && this._x < _root.wall_1._x) {
  this._x = _root.wall_1._x - this._width;
 }
 if (this.hitTest(_root.wall_1) && this._x >_root.wall_1._x+_root.wall_1._width) {
  this._x = _root.wall_1._x + _root.wall_1._width+this._width;
 }
}

So what I was hoping for was that when the ball collides with the wall on the left side, it would stop, and if it collides with the right side, it’s stop, but so far I have only been able to do detection on one side to make the ball stop. I can’t accomplish getting both to detect.

What is wrong with my code?

Also, I noticed this method of object movement is rather sluggish, what other methods might one suggest?