# How can I access the children of the child?

**URL:** <https://forum.kirupa.com/t/how-can-i-access-the-children-of-the-child/273313>\
**Category:** flash\
**Created:** [October 14, 2008, 10:12am UTC](https://forum.kirupa.com/t/how-can-i-access-the-children-of-the-child/273313 "2008-10-14T10:12:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![koneko](https://avatars.discourse-cdn.com/v4/letter/k/f6c823/32.png) [@koneko](https://forum.kirupa.com/u/koneko)\
**Post date:** [October 14, 2008, 10:12am UTC](https://forum.kirupa.com/t/how-can-i-access-the-children-of-the-child/273313/1 "2008-10-14T10:12:39Z")

</div>

How can I access the children of the child?

function function1()  
{  
var parentz:Parentz=new Parentz;  
addChild(parentz);  
parentz.name=“parentz”;  
//add the child  
var childz:Childz=new Childz;  
parentz.addChild(childz);  
childz.name=“childz”;  
}  
function function2()  
{  
MovieClip(getChildByName(“parentz”)).visible=false; //I can do that  
//How I do parentz.childz.visible=false ?  
}

Acttualy I can define an Array as a class variable and push the ‘childz’ instance, or make the instance as a class variable, so all the function recognize it. Still, I still doubt if that’s a proper way. Is it?  
I still fell that’s more flexible to define a new instance when I needed it. Am I wrong?  
Is there a way to reference the instance by name (getChildByName) or any other ways , but still in a scope like that?

Thx in adv.
