4 Replies Latest reply on Oct 17, 2007 7:29 AM by AScracker

    Hit Test

    sky_kim
      Hi friends, is there any possibility to get all the names of instances hited by an object when drag it over them.
        • 1. Re: Hit Test
          AScracker
          This is the code you can get the instance name of the clip and you need to write the script in the mouse move function.

          var Cliparray:Array = [_root.mc,...................]
          Inside the array you can place the path of the movie clip
          for (var i in Cliparray) {
          var current_mc_Name:MovieClip = __tool_array ;
          if (current_mc_Name.hitTest(_root._xmouse, _root._ymouse)) {
          trace(_current_mc_Name)
          }
          }

          ~~
          SK
          • 2. Re: Hit Test
            sky_kim Level 1
            Thank u, that works, but is there any EventListener or other trick to get instances without compare with an Array.
            • 3. Re: Hit Test
              clbeech Level 3
              you could try something like:
              • 4. Re: Hit Test
                AScracker Level 1
                for (var i = 0; i<=10; i++) {
                var container:MovieClip;
                container = _root["clip_"+i];
                // ur Movieclip instance name Should be clip_1,clip_2,clip_3..........................
                if (container.hitTest(_root._xmouse, _root._ymouse, true)) {
                __currentClip = container._name;
                }
                }