# Drag, Drop and Snap Question

**URL:** <https://forum.kirupa.com/t/drag-drop-and-snap-question/250336>\
**Category:** flash\
**Created:** [January 28, 2008, 5:20pm UTC](https://forum.kirupa.com/t/drag-drop-and-snap-question/250336 "2008-01-28T17:20:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crystal](https://avatars.discourse-cdn.com/v4/letter/c/2bfe46/32.png) [@Crystal](https://forum.kirupa.com/u/Crystal)\
**Post date:** [January 28, 2008, 5:20pm UTC](https://forum.kirupa.com/t/drag-drop-and-snap-question/250336/1 "2008-01-28T17:20:49Z")

</div>

Hello-

I am currently working on a game which includes a drag and drop timeline; however, I am unable to get the items to snap into their correct position. I can get the items to snap when dropped, they just do not snap into the center or in a proper alignment. They basically snap anywhere near the target and it looks really sloppy.

Does anyone know the code to make them snap to the center of the movie clip they are dropped to? Here is the code I am currently using:

on (press) {  
startDrag ("\_root.draft");  
}

on (release) {  
stopDrag ();  
if (this.hitTest(\_root.three)) {  
//snaps to timeline  
\_root.draft.\_x = \_root.three.\_x;  
\_root.draft.\_y = \_root.three.\_y;

```
}

```

}

Any help would be greatly appreciated!

Thanks,

-Crystal 🙂
