Setting Targets for Puzzle Pieces in Animate CC
Hello,
I have created a puzzle (ActionScript 3.0) with drag and drop pieces, assigned targets, and everything is working except for one thing which I can't figure out. If I move one puzzle piece, all of the pieces at the top suddenly snap to the top of the puzzle frame, and can't be moved above it freely. They keep snapping to that Y coordinate.
I have 8 pieces, but here is a sample of the code I am using:
piece1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_17);
function fl_ClickToDrag_17(event:MouseEvent):void
{
piece1.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_17);
function fl_ReleaseToDrop_17(event:MouseEvent):void
{
piece1.stopDrag();
if (target1.hitTestObject(piece1.tar1))
piece1.x = 218.5;
piece1.y = 309.4;
}
The code I am using is the same for each piece. The target1 is a square in Scene 1. tar1 is a square that it matches up to inside the piece1 movie clip.
Any suggestions would be greatly appreciated.
