# Parent not able to detect child's functions

**URL:** <https://forum.kirupa.com/t/parent-not-able-to-detect-childs-functions/257184>\
**Category:** flash\
**Created:** [April 11, 2008, 12:00am UTC](https://forum.kirupa.com/t/parent-not-able-to-detect-childs-functions/257184 "2008-04-11T00:00:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![triangle\_man](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@triangle\_man](https://forum.kirupa.com/u/triangle_man)\
**Post date:** [April 11, 2008, 12:00am UTC](https://forum.kirupa.com/t/parent-not-able-to-detect-childs-functions/257184/1 "2008-04-11T00:00:03Z")

</div>

I’ve encountered what seems to be a race condition between a parent and its child movie clips, but I don’t know what to do to fix it.

The parent movie clip is on the stage at compile-time, and the clip contains a number of children. In the parent’s constructor function I have the following code

for(var i in this){  
if(this\* instanceof MovieClip){  
this\*.hval = this\*.\_x;  
$tItems.push(this\*);  
this\*.subscribe(this);  
}  
}

I’m able to give every child an hval property and push it into $tItems, but the call to the child’s subscribe method fails every time. It’s as though the child’s functions haven’t been loaded because the children haven’t yet realized that they’re members of a class that have a subscribe function. I set up a button to test this function call manually and when I do it that way I succeed in calling the subscribe method in all the children, so it really seems to be some sort of race condition.

How can I overcome this?
