# New to AS3: how to refer to dynamically created children?

**URL:** <https://forum.kirupa.com/t/new-to-as3-how-to-refer-to-dynamically-created-children/246646>\
**Category:** flash\
**Created:** [December 13, 2007, 2:47am UTC](https://forum.kirupa.com/t/new-to-as3-how-to-refer-to-dynamically-created-children/246646 "2007-12-13T02:47:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aneurin\_Mark\_II](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/aneurin_mark_ii/32/1564_2.png) [@Aneurin\_Mark\_II](https://forum.kirupa.com/u/Aneurin_Mark_II)\
**Post date:** [December 13, 2007, 2:47am UTC](https://forum.kirupa.com/t/new-to-as3-how-to-refer-to-dynamically-created-children/246646/1 "2007-12-13T02:47:58Z")

</div>

Part one:

```auto
// Function to add the interface.
function addinterface():void {
    // Display library object.
    this.addChild (new interface_bars);
}

[..]

addinterface();

```

Part two:

```auto
interface_bars.hit1.addEventListener (MouseEvent.ROLL_OVER, trcseg(1));

```

Now I can display the interface\_bars object fine, but say there are objects inside it that I want to assign events. (There are. I’m just being hypothetical.)

I don’t know if the dynamically created child (from the interface\_bars class) has an instance name, or if it does what the name is. And, clearly, the second snippet of code won’t work because interface\_bars is a class. (hit1 is the instance name of an object within the class.) trcseg(), by the way, just traces the argument.

Any help for someone who’s only started learning AS3 in the last few hours? Thanks!

(PS. AS3 is pretty cool. It’s so much better structured than previous Flash/AS engines. It’ll just take a little while to get used to it…)
