# Multiple Hit Test Way to Condence?

**URL:** <https://forum.kirupa.com/t/multiple-hit-test-way-to-condence/60234>\
**Category:** flash\
**Created:** [August 8, 2004, 2:19am UTC](https://forum.kirupa.com/t/multiple-hit-test-way-to-condence/60234 "2004-08-08T02:19:15Z")\
**Posts on this page:** 3\
**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:** [August 8, 2004, 2:19am UTC](https://forum.kirupa.com/t/multiple-hit-test-way-to-condence/60234/1 "2004-08-08T02:19:15Z")

</div>

Is there a way to condence this. The t stands for tree and i have alot of them to hit test and i do not want to write out all the hit tests like below. Is there a way so it will accept any number after the T.

Heres the short version.  
if (this, hitTest(\_root.World.T1) or (this, hitTest(\_root.World.T2))) {  
EXT…

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 8, 2004, 2:37am UTC](https://forum.kirupa.com/t/multiple-hit-test-way-to-condence/60234/2 "2004-08-08T02:37:58Z")

</div>

yes there is, and its called an array. First you need to store all your instance names into an array and then apply the hitTest on the array through a loop. Ill try to outline the code for ya:  
tree\_amount = 25;  
trees = [];  
for(i=0;i\<tree\_amount;i++){  
trees\* = \_root.World[“T”+i]; //not sure if this is right,basically target your trees.  
}  
Then on the enterframe part:  
for(j=0;j\<\_root.tree\_amount;j++){  
if(this.hitTest(trees\*){  
trace(“tree was hit”);  
}  
}  
Remember this is just an outline of how I would code it, I hope you understand it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 8, 2004, 2:55am UTC](https://forum.kirupa.com/t/multiple-hit-test-way-to-condence/60234/3 "2004-08-08T02:55:29Z")

</div>

why I feel so dumb thanks bobdoe
