加载变量 stage.loaderInfo 时出错 - AS3
我有一个 Document 类,它使用 stage.loaderInfo 从 Facebook 加载变量
var connect:FacebookConnectObject = new FacebookConnectObject( facebook, API_KEY, this.stage.loaderInfo );
但是当我更改 Document 类时(另一个负责我的应用程序的布局),并尝试从我的应用程序中存在的影片剪辑中调用上述内容,使用:
var facebook_class:FacebookAp = new FaceBppkApp addChild(facebook_class)
我收到错误
TypeError: Error #1009: Cannot access a property or method of a null object reference.
我相信错误来自这一行
this.stage .loaderInfo
自从我更改了范围...
我应该如何解决这个问题?
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
I get error
addChild(facebook_class)
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 Devonair 的帖子:当人们遇到 1009 错误的问题时,100 次中似乎有 99 次是因为 stage 属性无法访问。
所以我使用了这个片段
public function start () {
如果
{(阶段)init();}
别的
{ addEventListener(Event.ADDED_TO_STAGE, init);
}
}
私有函数 init(event:Event = null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
// 其他一切...
}
如果某人遇到同样的问题...
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...