3 Replies Latest reply on Sep 6, 2013 11:00 AM by kglad

    hitTest().attachMovie() --> specified movieclip

    Ron Colmen Level 2

      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[i].getNextHighestDepth());

      ///

      }