I have searched the web for a solution and found none.;(
I have two rectangles, one of which is draggable, and when hitTestObject occurs I want to prevent the overlap.
here is the code:
[FONT=Courier New]addEventListener(Event.ENTER_FRAME, detectColl);
redSquare.addEventListener(MouseEvent.MOUSE_DOWN, grabIt);
redSquare.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function grabIt(event:MouseEvent):void {
event.target.startDrag(false);
}
function dropIt(event:MouseEvent):void {
event.target.stopDrag();
}
function detectColl(event:Event):void{
if (redSquare.hitTestObject(greenSquare)){
[COLOR=Red]????[/COLOR]
}
}
[/FONT]