# Check if object exists?

**URL:** <https://forum.kirupa.com/t/check-if-object-exists/246878>\
**Category:** flash\
**Created:** [December 15, 2007, 8:45pm UTC](https://forum.kirupa.com/t/check-if-object-exists/246878 "2007-12-15T20:45:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![corvenus](https://avatars.discourse-cdn.com/v4/letter/c/3ab097/32.png) [@corvenus](https://forum.kirupa.com/u/corvenus)\
**Post date:** [December 15, 2007, 8:45pm UTC](https://forum.kirupa.com/t/check-if-object-exists/246878/1 "2007-12-15T20:45:35Z")

</div>

Hi everyone,

Let’s say i have a menu comprised of several movie clips which are defined as buttons. Each of these MC contains a dynamic TextFields. The TextFields’ text is set from an array this way:

```auto

            total = arrId.length;

            for (i=0; i<total; i++) {
                    root["mc_"+arrId*]["txt_"+arrId*].text = arrTitles*;
                }
            }

```

So for example, this will set mc\_aboutus.txt\_aboutus.text = “About Us”, mc\_contact.txt\_contact.text = “Contact”, and so on. Now, the problem i have is that the MCs are created on the stage beforehand, but the array is built from an XML file, so i need to check if the MCs exist before i set their text property. I’d need to do something like:

```auto

if (root["mc_"+arrId*]["txt_"+arrId*] exists)
{
     root["mc_"+arrId*]["txt_"+arrId*].text = arrTitles*;
}
else
{
    // do nothing
}

```

How do i check that each MC exists?

Thanks for any input!
