Skip to main content
Participant
August 19, 2010
Question

single droptarget for multiple movie clips

  • August 19, 2010
  • 1 reply
  • 585 views

I have a movie clip which i use as a drop target. And I have four additional movie clips which can be dragged and dropped into the droptarget movie clip. But when I place a movie clip into a droptarget and I drop the second one too, the droptarget for the second one becomes the first movie clip but not the actual droptarget movie clip.

Please suggest.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
August 19, 2010

you can't change that.  you can work around it depending on what you want.

for example, if you want the _droptarget to not change, use swapDepths() to move the _droptarget above what ever's dropped on top of it.

or, don't use _droptarget and detect when a stopDrag() occurs over the original _droptarget.

Participant
August 19, 2010

Thank you for the reply. Can you give me an idea what the below code does?

mainContainer is a movie clip. mc1, mc2 are three movie clips

mainContainer.addChild( mc1 );

     and while dropping mc2

mc2._droptarget - what this will refer to?

kglad
Community Expert
Community Expert
August 20, 2010

mainContainer.addChild( mc1 );

// is as3 code that makes mc1 a child of mainContainer.

mc2._droptarget

// is as2 code that returns the movieclip onto which mc2 was dropped, if there is one.