# Switch problem?

**URL:** https://forum.kirupa.com/t/switch-problem/125083
**Category:** Uncategorized
**Created:** [October 9, 2004, 9:35pm UTC](https://forum.kirupa.com/t/switch-problem/125083 "2004-10-09T21:35:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Brandon](https://avatars.discourse-cdn.com/v4/letter/b/f08c70/32.png) [@Brandon](https://forum.kirupa.com/u/Brandon)
#### Post date: [October 9, 2004, 9:35pm UTC](https://forum.kirupa.com/t/switch-problem/125083/1 "2004-10-09T21:35:22Z")

</div>

Example (doesnt work):  
problem = \_root.World.DirectionDude.hitTest(\_root.Unit)  
switch(problem){  
case “DirectionDude” :  
trace(“hello”)  
break;  
case “AttackingDude” :  
trace(“ya”)  
break;  
defualt :  
trace(“nothing”)  
}  
Okay now say that the object (\_root.world.object) for the hit test changes alot how do i get it to just check for the object under the case, instead of having to type the entire \_root.wor… for each one.
