# Drag and Drop and Snap - help? \[CS5:AS3\]

**URL:** <https://forum.kirupa.com/t/drag-and-drop-and-snap-help-cs5-as3/312176>\
**Category:** flash\
**Created:** [July 27, 2010, 3:10pm UTC](https://forum.kirupa.com/t/drag-and-drop-and-snap-help-cs5-as3/312176 "2010-07-27T15:10:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kerry\_rnl](https://avatars.discourse-cdn.com/v4/letter/k/85f322/32.png) [@kerry\_rnl](https://forum.kirupa.com/u/kerry_rnl)\
**Post date:** [July 27, 2010, 3:10pm UTC](https://forum.kirupa.com/t/drag-and-drop-and-snap-help-cs5-as3/312176/1 "2010-07-27T15:10:53Z")

</div>

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();  
}  
Is there any code that I could add in there to make the objects then snap into positions when dragged near them? Note that there are five possible positions for them to snap to. The coordinates for those are:  
X Y  
299.75 235.90  
775.40 244.65  
421.15 447.45  
804.15 484.85  
437.15 599.60

Thanks!
