How to make a draggable object snap into place?
I'm new to Flash (sort of - I used it a bit back in 1999-2000, but it's changed a LOT since then). I'm making an educational game for my company that involves dragging labels from a word-bank to their correct position on a diagram. I want the kids to be able to drag any one of the five labels and move them to any one of five marked positions on the diagram. I'm using Flash CS5 with Actionscript 3. I used code snippets, so that each individual label has the following code associated with it:
movieClip_1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);
function fl_ClickToDrag(event:MouseEvent):void
{
movieClip_1.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);
function fl_ReleaseToDrop(event:MouseEvent):void
{
movieClip_1.stopDrag();
}
| X | Y |
|---|---|
299.75 | 235.90 |
| 775.40 | 244.65 |
| 421.15 | 447.45 |
| 804.15 | 484.85 |
| 437.15 | 599.60 |
Here is a screenshot of the area of the game that this is concerning to give you an idea of what I'm talking about:
Thanks for any help you can give me.
