Not able to move?

Hi! Im trying diffrent things to learn Flash. I wrote this very simple code that moves a 50 x 50 big cube.

Block.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);

function fl_ClickToPosition(event:MouseEvent):void
{
    Block.x += 50;    
}


Then I did another Cube also 50 x50 pixels. As you can see on the code… If I press Block, block moves 50 to the right. Now. Here comes my problem. I want the cube to stop for the other cube called “Wall”. But i dont know how to do that.

I want Block to be able so move as many times as poassible. But if “Wall” stands in the way. Block shouldnt be able to move.