AS3和Loader类 [英] AS3 and the loader class

查看:160
本文介绍了AS3和Loader类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写在这里,因为寻找一个解决方案后,我解决不了我的错误...

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);  
}

这是错误:

类型错误:错误#1009:伊尔EST不可能D'accéder点菜propriété欧点菜METHODE D'UNE提及此战争德OBJET NUL。在主:: StateManager的()

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?

推荐答案

根据您的意见我认为 StateManager的()从文档类的构造函数被调用远程SWF和试图访问使用类似 this.stage 这一点。 root.stage 。现在,当作为一个独立的SWF运行,因为属性将已经由当时的文件类的构造函数的集合称为它会工作没有任何问题。当远程加载仅设置之后您在完整的处理程序中添加它。

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 access stage using something like this.stage or this.root.stage. Now, it'll work without any issues when run as a standalone SWF because the stage property would've been set by the time document class's constructor is called. When loaded remotely stage is set only after you add it in the complete handler.

我不知道这一点,但尝试调用的addChild(符号); 在打电话之前 sign.load - 你可以删除 completeSign 方法这两行

I'm not sure about this, but try calling addChild(sign); before you call sign.load - you can remove those two lines from the completeSign method.

这篇关于AS3和Loader类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆