# ADD\_TO\_STAGE vs someChild.init()

**URL:** <https://forum.kirupa.com/t/add-to-stage-vs-somechild-init/277123>\
**Category:** flash\
**Created:** [December 8, 2008, 6:50am UTC](https://forum.kirupa.com/t/add-to-stage-vs-somechild-init/277123 "2008-12-08T06:50:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhangxiaorui](https://avatars.discourse-cdn.com/v4/letter/z/e495f1/32.png) [@zhangxiaorui](https://forum.kirupa.com/u/zhangxiaorui)\
**Post date:** [December 8, 2008, 6:50am UTC](https://forum.kirupa.com/t/add-to-stage-vs-somechild-init/277123/1 "2008-12-08T06:50:34Z")

</div>

As we cannot use “root” or “stage” when we just new a child (before we addChild it to the displayList), we had to use the two ways:

1. trigger the initHandler with ADD\_TO\_STAGE:

```auto
// constructor of some child
public function SomeChild()
{
    this.addEventListener(Events.ADD_TO_STAGE, initHandler);
}

private function initHandler(event:Event):void
{
    // Make the listener disable so that it won't 
    // be triggered for more than once.
    this.removeEventListener(Event.ADD_TO_STAGE, initHandler);

    // the main logic
}

```

1. call the init function from outside:

```auto
someChild = new SomeChild();
// a public function in the class "SomeChild"
someChild.init();

```

Comparing these two ways, which one do you prefer? Or is there any other possibilities?
