开发者

Error Referencing Externally loaded SWF

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.t开发者_高级运维estMovie.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;
}

If testMovie is yet another dynamically loaded SWF, wait till it is loaded - listen to the complete event dispatched by testMovie.contentLoaderInfo.

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.


You can't reference something that hasn't loaded. If you want to apply a transform you can do that on the parent clip but this might not be what you are after.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜