views:

247

answers:

1

I have a Document class that loads variables from Facebook with the use of stage.loaderInfo

var connect:FacebookConnectObject = new FacebookConnectObject( facebook, API_KEY, this.stage.loaderInfo );

But when I change the Document class (with another one responsible for the layout of my app), and try call the above from a movieclip that exists in my application with the use:

var facebook_class:FacebookAp = new FaceBppkApp addChild(facebook_class) I get error

TypeError: Error #1009: Cannot access a property or method of a null object reference.

I believe the error comes fro this line

this.stage.loaderInfo

since I changed the scope...
How I am supposed to fix that?

A: 

According to a post by Devonair: Seems 99 times out of a 100 when people have a problem with a 1009 error, it's because the stage property is inaccessible.

so I used this snippet

public function start() { if {(stage) init();} else { addEventListener(Event.ADDED_TO_STAGE, init); } }

private function init(event:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // everything else... }

In case sb has the same problem...

Dimitree