# Referencing multiple movieclips with similar instance names

**URL:** <https://forum.kirupa.com/t/referencing-multiple-movieclips-with-similar-instance-names/332124>\
**Category:** flash\
**Created:** [February 8, 2014, 4:04pm UTC](https://forum.kirupa.com/t/referencing-multiple-movieclips-with-similar-instance-names/332124 "2014-02-08T16:04:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cyanampersand](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@cyanampersand](https://forum.kirupa.com/u/cyanampersand)\
**Post date:** [February 8, 2014, 4:04pm UTC](https://forum.kirupa.com/t/referencing-multiple-movieclips-with-similar-instance-names/332124/1 "2014-02-08T16:04:48Z")

</div>

I have a player movieclip and six obstacle movieclips with instance names “obs1”, “obs2”, up to “obs6”. If the player hits any of the obstacles, the variable dead is set to true. The code I have at the moment is:

```auto
if (hitTest(_root.obs1)||hitTest(_root.obs2)||hitTest(_root.obs3)||hitTest(_root.obs4)||hitTest(_root.obs5)||hitTest(_root.obs6)) {
dead = true
}

```

Since that if statement looks pretty ugly as it is, I wanted to know whether it was possible to reference all movieclips with the instance name “obs” followed by a number. I believe it involves square brackets, something like:

```auto
hitTest(_root.obs*)

```

Can anyone give me some pointers?  
(I’m using Flash CS3)
