开发者

Error loading Variables stage.loaderInfo - AS3

I 开发者_StackOverflow中文版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?


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜