moglie
asked on
as3 droptarget
I'm doing a drag and drop interaction. The very basic code is
I'll have several draggable objects and droptargets. Now the problem I have is if a given droptarget already has something dropped on it, it shouldn't allow anything else to be dropped on it ie. "disabled". If I drag the object off of it, that particular target would need to be "enabled" again. Haven't come up with any idea on how to do this.
Oh yeah, all the draggable objects are able to be dropped on all of the droptargets. I'll evaluate whether the correct objects have been dropped on the correct targets later.
function mouseDown(event:MouseEvent):void
{
event.currentTarget.startDrag();
}
function mouseReleased(event:MouseEvent):void
{
event.currentTarget.stopDrag();
if (event.currentTarget.dropTarget != null)
{
event.currentTarget.x = event.currentTarget.dropTarget.parent.x;
event.currentTarget.y = event.currentTarget.dropTarget.parent.y;
}
}
I'll have several draggable objects and droptargets. Now the problem I have is if a given droptarget already has something dropped on it, it shouldn't allow anything else to be dropped on it ie. "disabled". If I drag the object off of it, that particular target would need to be "enabled" again. Haven't come up with any idea on how to do this.
Oh yeah, all the draggable objects are able to be dropped on all of the droptargets. I'll evaluate whether the correct objects have been dropped on the correct targets later.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why not simply add a flag to the drop target that says there is something dropped in it? MovieClips are dynamic; you can create a new field and check to see if it exists and is set in your MouseDown event.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
ASKER