Copy link to clipboard
Copied
Can any one assist? I have a box that has six labels that can be dropped on targets on the box. I have all this in place but I want to be able to have label 2 drop onto target 2 and 3, and likewise label 3 drop on to target 2 and 3. All others drop onto their specific targets. This is the script so far but ony for matching object to target. Please be gentle, i'm new to this!!
event.target.stopDrag();
var myTargetName:String="target" + event.target.name;
var myTarget:DisplayObject=getChildByName(myTargetName);
if (event.target.dropTarget!=null&&event.target.dropTarget.parent==myTarget)
Can anyone assist please?
Copy link to clipboard
Copied
What you could do is have an array assigned to each dragged item that defines the allowed targets for each dragged item and check if the dropTarget is in the array using the indexOf() method.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now