PDA

View Full Version : [AS3] Add loader to stage?


deAd
11-09-2006, 05:43 PM
I have a big problem with ActionScript 3. I'm working in Flex Builder 2. The following code throws a null reference error:

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.

senocular
11-09-2006, 06:22 PM
try using applicationComplete instead

deAd
11-09-2006, 06:32 PM
thanks that worked!!!!