Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Participant ,
Sep 06, 2013 Sep 06, 2013

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());

///

}

TOPICS
ActionScript
792
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 06, 2013 Sep 06, 2013

you can't reparent movieclips using as2.  you can fake it by instantiating (attachMovie) the identical library symbol and removing the original.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 06, 2013 Sep 06, 2013

Thanks Kglad.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 06, 2013 Sep 06, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines