Keeping objects from intersecting

I’m having trouble getting this work. I have two squares, one that the player controls, and one that stands still. I’m trying to make it so when you hit the still square with the controlled one, it can’t go through it. I don’t want the one to bounce off. I want it to just stop, and not be through the still one. The fla. is attached. Thanks

hi dangerskew

just add this to ur unmovable square.

onClipEvent (enterFrame) {
 if (this.hitTest(_root.playersquare)) {
  _root.playersquare._x = this._x-10;

and might i suggest reversing the controls while going backwards???