AS3 和加载器类
我写在这里,因为在寻找解决方案后,我无法解决我的错误......
var test:MovieClip;
var sign:Loader = new Loader();
sign.contentLoaderInfo.addEventListener(Event.COMPLETE, completSIGN);
sign.load(new URLRequest("http://files.zebest-3000.com/278374/3011/3011.swf"));
function completSIGN(e:Event):void
{
test = MovieClip(e.target.content);
addChild(test);
}
这是错误:
TypeError:错误#1009:无法通过属性或对象参考方法进行访问。在 Main::StateManager()
因此,电影(有些视频可以完美运行,有些则不能)不想加载到我的容器中;看来映射有问题...并且无法修改远处的电影。
- 是否还有其他方法可以将电影加载到另一个电影中(我也尝试过使用 bytearray 加载,但它是相同的)?
- 我们能否捕获这个错误并重新定位实例以帮助他找到正确的方法?
I write here, because after looking for a solution, I could not resolve my error...
var test:MovieClip;
var sign:Loader = new Loader();
sign.contentLoaderInfo.addEventListener(Event.COMPLETE, completSIGN);
sign.load(new URLRequest("http://files.zebest-3000.com/278374/3011/3011.swf"));
function completSIGN(e:Event):void
{
test = MovieClip(e.target.content);
addChild(test);
}
This is the error:
TypeError: Error #1009: Il est impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul. at Main::StateManager()
So, the movie (some videos work perfectly and others not) does not want to load in my container ; it seems there is a problem in the mapping... and can't modify the distant movie.
- Is there an other method of loading a movie inside one other (I have try also to load with bytearray, but it's the same)?
- Can we catch this error and relocate the instance to help him to find the correct way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您的评论,我假设从远程 SWF 文档类的构造函数调用
StateManager()
,并且它尝试使用类似this 的内容访问
或stage
.stagethis.root.stage
。现在,当作为独立的 SWF 运行时,它可以正常工作,因为stage
属性将在调用文档类的构造函数时设置。远程加载时,仅在将其添加到完整处理程序中后才设置阶段。我对此不确定,但尝试在调用
sign.load
之前调用addChild(sign);
- 您可以从completeSign< 中删除这两行/代码> 方法。
Based on your comment I assume that
StateManager()
is called from the constructor of the document class of the remote SWF and it tries to accessstage
using something likethis.stage
orthis.root.stage
. Now, it'll work without any issues when run as a standalone SWF because thestage
property would've been set by the time document class's constructor is called. When loaded remotelystage
is set only after you add it in the complete handler.I'm not sure about this, but try calling
addChild(sign);
before you callsign.load
- you can remove those two lines from thecompleteSign
method.