# getChildByName mc inside mc

**URL:** https://forum.kirupa.com/t/getchildbyname-mc-inside-mc/282987
**Category:** flash
**Created:** [March 1, 2009, 1:12am UTC](https://forum.kirupa.com/t/getchildbyname-mc-inside-mc/282987 "2009-03-01T01:12:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ryrocks](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@ryrocks](https://forum.kirupa.com/u/ryrocks)
#### Post date: [March 1, 2009, 1:12am UTC](https://forum.kirupa.com/t/getchildbyname-mc-inside-mc/282987/1 "2009-03-01T01:12:04Z")

</div>

Hey,  
I’m trying to declare a movieclip variable in a class by finding the instance name of the movieclip.

On my stage I have a ‘Container’ (linkage class name) MC, inside that is a ‘PlayerInfo’ (linkage class name) MC inside that is a ‘healthBar\_mc’ (instance name) MC.  
healthBar\_mc is what I’m trying to access.

the class where I’m trying to run this function is linked to a MC inside ‘Container’

So I tried the following code:

```auto

_healthBar_mc = parent.PlayerInfo.getChildByName("healthbar_mc") as MovieClip;

```

I get an error: “Undefined property PlayerInfo”

If healthbar was just inside ‘Container’ and not ‘PlayerInfo’ then the following would work:

```auto

 _healthBar_mc = parent.getChildByName("healthbar_mc") as MovieClip;

```

But I need it to be inside PlayerInfo.

What am I doing wrong?

Thanks
