开发者

Cannot load swf from another domain

开发者 https://www.devze.com 2023-01-06 14:42 出处:网络
I\'m successfully loading swf from another domain, but when i addChild loaded content, it doe开发者_StackOverflow社区sn\'t appear on the stage.

I'm successfully loading swf from another domain, but when i addChild loaded content, it doe开发者_StackOverflow社区sn't appear on the stage. My firebug shows that swf loaded with status (304 Not Modified), means no problem.

Why i cannot see loaded swf content on the stage?

Thank you


I have found the problem.
I wanna share it to you, because anyone can face with such a problem. This problem doesn't cause any error, so it's hard to find it.

We need just add loaderContext as second parameter in load method. Before assigning it there we must declare it in this way:

var loader_context:LoaderContext = new LoaderContext();
if (Security.sandboxType!='localTrusted') loader_context.securityDomain = SecurityDomain.currentDomain;
loader_context.applicationDomain = ApplicationDomain.currentDomain;

loader.load(url, loader_context);

That's all!


maybe its a crossdomain problem. do you have a crossdomain.xml file on the external server?

example xml

0

精彩评论

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

关注公众号