3 Replies Latest reply on Jul 5, 2007 7:23 AM by jude86

    Movie Clips Trouble

    jude86 Level 1

      Just wondering if anyone can help me.

      I have a series of movie clips, movieClip1_mc, movieClip2_mc, movieClip3_mc.............etc. and i have another series of dragable movie clips, drag1_mc, drag2_mc, drag3_mc...............etc.

      I need to code my action script so that when drag1_mc is droped within movieClip1_mc or 2 or 3 etc that the name of the movie clip which is the target (ie movieClip1_mc) to be put into a variable, from there i can then work with that variable.

      Any ideas, i hope that makes sense :)

      Many thanks any help is greatly apppreciated :-)


        • 1. Re: Movie Clips Trouble
          Pop_Clingwrap Level 1
          when you release the dragged clip perform a loop through all the target clips (store them in an array or a container clip) and do a hitTest() for each one against the drag clip. If the hitTest returns true then send that clip to your variable.

          If the drag clips are nested away from the target clips you may need to use the localToGlobal method to get accurate co ordinates
          • 2. Re: Movie Clips Trouble
            jude86 Level 1
            Thanks a lot for your help, i shall give it a go and see how i get on :-)

            Many thanks again

            Much appreciated

            • 3. Re: Movie Clips Trouble
              jude86 Level 1

              Okay so ive set up my array with all of the movie clips names inside, this array is called 'mcArray'

              Than i set up a simple loop but i dont know if this is correct:

              for( var i= 0; i<=mcArray.length; i++){


              now inside this i am required to put the hit test in arent i?

              So far i put this in


              This is a total stab in the dark at this so im sorry if im wrong, lol however this bring up false for every field in the array when i trace it, is this because my code is wrong or because my movie clips are not in the same place, they start off on the same level but drag1_mc goes down a few more levels than movieClip_mc, could this be my problem??

              Many thanks