# Drag-n-drop problem

**URL:** <https://forum.kirupa.com/t/drag-n-drop-problem/200483>\
**Category:** flash\
**Created:** [September 12, 2006, 4:27pm UTC](https://forum.kirupa.com/t/drag-n-drop-problem/200483 "2006-09-12T16:27:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AGKbrian](https://avatars.discourse-cdn.com/v4/letter/a/96bed5/32.png) [@AGKbrian](https://forum.kirupa.com/u/AGKbrian)\
**Post date:** [September 12, 2006, 4:27pm UTC](https://forum.kirupa.com/t/drag-n-drop-problem/200483/1 "2006-09-12T16:27:08Z")

</div>

Ok so here is what i have for code (see below). What the problem is, is that when i drag the button over to the correct hotspot, i alwasy get a “wrong answer”. I put the color changing in there so i know it would be targeting the right spot, and the correct variable is passed to the function. Any ideas what could be causing this not to work for me?

[COLOR=#993300]for[/COLOR] [COLOR=#000000]([/COLOR]i=[COLOR=#000000]0[/COLOR]; i\<=[COLOR=#000000]25[/COLOR]; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]  
assignBtnsCOLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]

[COLOR=#993300]function[/COLOR] assignBtnsCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#993300]var[/COLOR] btn = [COLOR=#993300]\_root[/COLOR][COLOR=#000000][[/COLOR][COLOR=#0000FF]“symbolName”[/COLOR]+i[COLOR=#000000]][/COLOR];  
btn.[COLOR=#993300]onPress[/COLOR] = [COLOR=#993300]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#993300]startDrag[/COLOR][COLOR=#000000]([/COLOR][COLOR=#993300]this[/COLOR], [COLOR=#993300]true[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR];  
btn.[COLOR=#993300]onRelease[/COLOR] = [COLOR=#993300]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#993300]stopDrag[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#993300]\_root[/COLOR].[COLOR=#000000]stopThis[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR];  
[COLOR=#000000]}[/COLOR]

[COLOR=#993300]function[/COLOR] stopThisCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#993300]var[/COLOR] chgColor = [COLOR=#993300]new[/COLOR] [COLOR=#993300]Color[/COLOR]COLOR=#000000[/COLOR];  
chgColor.[COLOR=#993300]setRGB[/COLOR]COLOR=#000000[/COLOR];

```
[COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR]aNum[COLOR=#000000])[/COLOR];
[COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#993300]this[/COLOR].[COLOR=#993300]_droptarget[/COLOR] == [COLOR=#0000FF]"/cellBlank"[/COLOR]+aNum[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#993300]this[/COLOR].[COLOR=#993300]_x[/COLOR] = [COLOR=#000000]1600[/COLOR];
    [COLOR=#993300]this[/COLOR].[COLOR=#993300]_y[/COLOR] = [COLOR=#000000]1600[/COLOR];
    [COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]"right spot"[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR] [COLOR=#993300]else[/COLOR] [COLOR=#000000]{[/COLOR]
    [COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]"wrong spot"[/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#000000]}[/COLOR]

```

[COLOR=#000000]}[/COLOR];
