# \[AS3\] Add loader to stage?

**URL:** <https://forum.kirupa.com/t/as3-add-loader-to-stage/206623>\
**Category:** flash\
**Created:** [November 9, 2006, 9:43pm UTC](https://forum.kirupa.com/t/as3-add-loader-to-stage/206623 "2006-11-09T21:43:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![deAd](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@deAd](https://forum.kirupa.com/u/deAd)\
**Post date:** [November 9, 2006, 9:43pm UTC](https://forum.kirupa.com/t/as3-add-loader-to-stage/206623/1 "2006-11-09T21:43:36Z")

</div>

I have a big problem with ActionScript 3. I’m working in Flex Builder 2. The following code throws a null reference error:

```auto
public function Initialize():void{
var l:Loader = new Loader();
stage.addChild(l); // null?
l.x = 100;
l.y = 100;
}

```

I’ve worked out that the stage::addChild method is the source of the problem.

Note: the function is called on the creationComplete trigger.
