Copy link to clipboard
Copied
I've got 12 movieclips (holder_mc) and another movieclip (tf_mc) to be dragged&dropped. If the drop is within one of those 12 holder_mcs, I want to be able to use attachMovie to attach the dropped clip into a specified movieclip within the relevant movieclips, movieclips, movieclip.
e.g.:
if tf_mc is dropped on to holder_mc7, then tf_mc should be attached to holder_mc7.InnerHolder1.InnerHolder2
if tf_mc is dropped on to holder_mc3, then tf_mc should be attached to holder_mc3.InnerHolder1.InnerHolder2
The below code is being loaded as an external swf in to _root.mc1.mc2 (hitTest is successful, but it doesn't attach as I want)
Illustrative purposes only:
var dDroppedMC:Array = new Array();
tf_mc.move.onRelease=tf_mc.move.onReleaseOutside=function(){
dDroppedMC.splice(0);
this._parent.stopDrag();
for(j=0; j<6;j++){
if (this._parent.hitTest(_root["holder_mc"+j])) {
dDroppedMC.push(_root["holder_mc"+j].InnerHolder1.InnerHolder2);
}
var tfP:MovieClip = mc.attachMovie("tfID","tfP"+TxtNum++, dDroppedMC.getNextHighestDepth());
///
}
Copy link to clipboard
Copied
you can't reparent movieclips using as2. you can fake it by instantiating (attachMovie) the identical library symbol and removing the original.
Copy link to clipboard
Copied
Thanks Kglad.
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now