# Drag and drop craziness

**URL:** https://forum.kirupa.com/t/drag-and-drop-craziness/228299
**Category:** flash
**Created:** [June 6, 2007, 6:55pm UTC](https://forum.kirupa.com/t/drag-and-drop-craziness/228299 "2007-06-06T18:55:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![golden14](https://avatars.discourse-cdn.com/v4/letter/g/ed655f/32.png) [@golden14](https://forum.kirupa.com/u/golden14)
#### Post date: [June 6, 2007, 6:55pm UTC](https://forum.kirupa.com/t/drag-and-drop-craziness/228299/1 "2007-06-06T18:55:44Z")

</div>

Hello,

I have 2 problems related to drag and drop. Here’s the scenario. I have a red mc that can be dragged into 6 different slots ( each is a mc). When Red hits one of the drop targets, it will snap into that slot. The 6 slots are inside of a mc called circle. I have it set this way because the circle is movable and I want the slots to move with it. Here comes the 2 problems.

1: When Red snaps into a slot, it seemingly disappears. If you maximize the window, what is actually happening is that it moves off the stage and out of sight. I think that has to do with the fact that the slots are inside the circle mc, but I’m not sure.

2: Once that is fixed and Red stays snapped inside a slot, I want to be able to move the circle and have Red stay in the slot its snapped to.

Here is the code, and I also attached the .fla file. Any help would be appreciated. Thanks!

```
ActionScript Code:
[FONT=Courier New][LEFT]slots = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000FF]Array[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"circle.slot1"[/COLOR], [COLOR=#FF0000]"circle.slot2"[/COLOR], [COLOR=#FF0000]"circle.slot3"[/COLOR], [COLOR=#FF0000]"circle.slot4"[/COLOR], [COLOR=#FF0000]"circle.slot5"[/COLOR], [COLOR=#FF0000]"circle.slot6"[/COLOR][COLOR=#000000])[/COLOR];

```

circle.[COLOR=#0000FF]onPress[/COLOR] = [COLOR=#000000] **function** [/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]startDrag[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
circle.[COLOR=#0000FF]onRelease[/COLOR] = [COLOR=#000000] **function** [/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]stopDrag[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]

red.[COLOR=#0000FF]onPress[/COLOR] = [COLOR=#000000] **function** [/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]startDrag[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
red.[COLOR=#0000FF]onRelease[/COLOR] = [COLOR=#000000] **function** [/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]stopDrag[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#0000FF]for[/COLOR] [COLOR=#000000]([/COLOR]i=[COLOR=#000080]0[/COLOR]; i\<slots.[COLOR=#0000FF]length[/COLOR]; i++[COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000FF]eval[/COLOR]COLOR=#000000[/COLOR] == [COLOR=#0000FF]eval[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]  
red.[COLOR=#0000FF]\_x[/COLOR] = [COLOR=#0000FF]eval[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000FF]\_x[/COLOR];  
red.[COLOR=#0000FF]\_y[/COLOR] = [COLOR=#0000FF]eval[/COLOR]COLOR=#000000[/COLOR].[COLOR=#0000FF]\_y[/COLOR];  
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]swapDepths[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]  
[/LEFT]  
[/FONT]
