# Any other way of doing it? Movieclip's name as a variable?

**URL:** <https://forum.kirupa.com/t/any-other-way-of-doing-it-movieclips-name-as-a-variable/299271>\
**Category:** flash\
**Created:** [November 2, 2009, 1:45pm UTC](https://forum.kirupa.com/t/any-other-way-of-doing-it-movieclips-name-as-a-variable/299271 "2009-11-02T13:45:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadaj](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kadaj/32/9061_2.png) [@kadaj](https://forum.kirupa.com/u/kadaj)\
**Post date:** [November 2, 2009, 1:45pm UTC](https://forum.kirupa.com/t/any-other-way-of-doing-it-movieclips-name-as-a-variable/299271/1 "2009-11-02T13:45:55Z")

</div>

Hi,

I have one horse animation in the library.  
I have made 6 instances of the Horse() that’s in the library named:

horse0\_mc  
horse1\_mc  
…  
…  
horse5\_mc

I have a function called checkBound() that checks whether the horse has crossed a particular line (x value)  
The code is:

```auto
function checkBound()
{
    if (horse0_mc.x <= -800) {
        Hwin(0);        
    } else if (horse1_mc.x <= -800) {
        Hwin(1);
    } else if (horse2_mc.x <= -800) {
        Hwin(2);
    } else if (horse3_mc.x <= -800) {
        Hwin(3);
    } else if (horse4_mc.x <= -800) {
        Hwin(4);
    } else if (horse5_mc.x <= -800) {
        Hwin(5);
    } 
}

```

Instead of typing the whole instances of the horse  
can I do it with one if and else with the changing values as variables?  
**Problem** : If so how is horse **X** \_mc where **X** = 0, 1, …5 be written ?  
I suppose we could easily pass the corresponding variable **X** to the function Hwin( **X** ).  
Hope the question is clear.

Thank You.
