Is it possible while dragging a mc to have a conditional statement?
What I would like to do is drag a mc and if it overlaps another mc, the dragging mc changes frame. It will only change frames when it is dropped, I would like to have it change frame while still dragging.
Code:
stop();
function dragMe(e:MouseEvent):void {
dragObject.startDrag(true);
//does not have any effect
if (dragObject.hitTestObject(hitObject)) {
dragObject.gotoAndStop(2);
} else {
dragObject.gotoAndStop(1);
}
}
dragObject.addEventListener(MouseEvent.MOUSE_DOWN, dragMe);
function dropMe(e:MouseEvent):void {
//but this works fine
if (dragObject.hitTestObject(hitObject)) {
dragObject.stopDrag();
dragObject.gotoAndStop(2);
} else {
dragObject.stopDrag();
dragObject.gotoAndStop(1);
}
}
dragObject.addEventListener(MouseEvent.MOUSE_UP, dropMe);