# AS2/CS3 - How to switch(hitTest)?

**URL:** https://forum.kirupa.com/t/as2-cs3-how-to-switch-hittest/290317
**Category:** flash
**Created:** [June 12, 2009, 4:20pm UTC](https://forum.kirupa.com/t/as2-cs3-how-to-switch-hittest/290317 "2009-06-12T16:20:52Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![descalabro](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@descalabro](https://forum.kirupa.com/u/descalabro)
#### Post date: [June 12, 2009, 4:20pm UTC](https://forum.kirupa.com/t/as2-cs3-how-to-switch-hittest/290317/1 "2009-06-12T16:20:52Z")

</div>

Hi.

My question is how do I use switch method with hitTest?

In this case I want to use the hitTest with the same intent of the \_droptarget:

```auto

on (release) {
    switch (_root.object6.hitTest) {
        case _root.jogo.labirinto.fenda_MC :
            stopDrag();
            trace("fenda");
            _root.objects[6] = 3;
            break;

```

I’m not using switch(\_root.object6.\_droptarget) because I can’t get it to work when the movieClip object6 is in the \_root while the movieClip fenda\_MC is inside another movieClip (I made it work when both movies were at the \_root though).

I’ve always wandered why the droptarget of a movieClip doesn’t have defined the location where it is standing.

I mean, if I use…

```auto

on (release) {
    switch (_root.object7._droptarget) {
        case "/fenda_MC" :
            stopDrag();
            trace("fenda");
            _root.objects[7] = 3;
            break;

```

…I’m not telling my program where fenda\_MC is located, and yet it works if both movieClips are at the \_root (probably this is the reason we don’t need to tell the program the location of fenda\_MC). I’ve tried to use case “/\_root.jogo.labirinto.fenda\_MC” : but it doesn’t work (it’s not working if I remove the slash("/") either).

So, I would like you to tell me either how I use swtich with hitTest or the correct way to tell the program the path to drop the object in its target.

Thank you.
