Hi guys,
I’m having a little problem of which I’m guessing the solution isn’t that hard… but I just can’t put my finger on it…
The thing is:
I have got 5 movieclips which are able to drag and drop. Next to that I’ve got 20 containers which are all droptargets. The movieclips are able to be dragged and then dropped on a container. So far so good…
But what I want is that when I drop a movieclip on a container which already has a movieclip dropped on it, the first movieclip gets removed and the second movieclip is dropped on the container. Or you could also say… that the second movieclip replaces the first movieclip. This instead of the fact that a container has multiple movieclips dropped on itself.
ActionScript Code:
[LEFT][COLOR=#0000FF]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]**var**[/COLOR] i:[COLOR=#0000FF]int[/COLOR] = [COLOR=#000000]**new**[/COLOR] [COLOR=#0000FF]int[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000])[/COLOR]; i < containers.[COLOR=#0000FF]length[/COLOR]; i++[COLOR=#000000])[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]if[/COLOR] COLOR=#000000[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"snapped: "[/COLOR] + i[COLOR=#000000])[/COLOR];
[COLOR=#0000FF]stage[/COLOR].[COLOR=#000080]removeChild[/COLOR]COLOR=#000000[/COLOR];
containers[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#000080]addChild[/COLOR]COLOR=#000000[/COLOR];
_currentSymbol.[COLOR=#000080]x[/COLOR] = [COLOR=#000080]21[/COLOR];
_currentSymbol.[COLOR=#000080]y[/COLOR] = [COLOR=#000080]25[/COLOR];
$dropped = [COLOR=#000000]true[/COLOR];
[COLOR=#0000FF]break[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[/LEFT]
I hope someone can help me…