问题描述
我加载一个SWF说test.swf,这被在ImageLoader的加载,所以我可以得到它的内容:
I'm loading an swf say "test.swf" which gets loaded in imageLoader , so I can get its content by :
imageLoader.content
所以,如果我想它里面的影片剪辑我会做这样的一个:
So if I wanted one of the movieClips inside it I would do this :
imageLoader.content.testMovie.transform.colorTransform = someTransformation;
但是,当我做到这一点,因为影片没有加载未编译的文件,并给了我一个错误的引用的东西是不存在的。怎么回事我应该引用稍后将加载的内容?
But when I do this, since the movie is not loaded the file is not compiled and gives me an error your referring to something that is not there. How else am I supposed to reference a content that will be loaded later?
推荐答案
等到它被加载。听其完整
事件和访问内容在那里。
Wait till it is loaded. Listen to its complete
event and access content from there.
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad);
function onLoad(e:Event):void
{
MovieClip(imageLoader.content).testMovie.transform.colorTransform = someTransformation;
}
如果 testMovie
又是一个动态加载的SWF,等到它被加载 - 听完整
事件调度通过 testMovie.contentLoaderInfo
。
If testMovie
is yet another dynamically loaded SWF, wait till it is loaded - listen to the complete
event dispatched by testMovie.contentLoaderInfo
.
更妙的是,如果你有机会到加载的SWF,调度自定义事件,从那里时, testMovie
加载,并从主SWF听吧。
Even better, if you have access to the loaded SWF, dispatch a custom event from there when testMovie
is loaded and listen to it from the main SWF.
这篇关于错误引用外部加载SWF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!