【问题标题】:Load External Swf From Link [As3]从链接加载外部 Swf [As3]
【发布时间】:2013-07-19 19:58:25
【问题描述】:

我正在尝试从 as3 中的链接调用 swf。我在互联网上搜索并使用了此代码

var my_Loader:Loader = new Loader();
var my_url:URLRequest=new URLRequest("http://gurselgunacar.web44.net/flash/yalitimhesabi.swf");
my_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishLoading);
my_Loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
my_Loader.load(my_url);
function finishLoading(loadEvent:Event) {
addChild(loadEvent.currentTarget.content);
}
function errorHandler(errorEvent:Event):void {
trace("file missing");
}

as3 调用链接,但我不能在 swf 中做任何事情。在输出闪存中给出安全错误。我尝试了 crossdomain.xml 的东西,但它没有用:S

【问题讨论】:

  • 我认为在 Flash 环境中进行本地测试时,您不能像这样从 Internet 请求文件。尝试将您的 swf 文件上传到您的虚拟主机。
  • 但我需要 .exe 格式:S

标签: actionscript-3


【解决方案1】:

文件http://gurselgunacar.web44.net/crossdomain.xml 不存在。你应该创建一个。
Loader 将始终在目标服务器上查找 crossdomain.xml 文件。

【讨论】:

  • 我上传但还是一样。 ttp://www.adobe.com/xml/dtds/cross-domain-policy.dtd" rel="nofollow" target="_blank">adobe.com/xml/dtds/cross-domain-policy.dtd">
【解决方案2】:


嗯。尝试添加这些安全的东西:

Security.allowDomain("*");
Security.loadPolicyFile("http://gurselgunacar.web44.net/crossdomain.xml");

并在 URLRequest 中使用它:

var my_url:URLRequest=new URLRequest("http://gurselgunacar.web44.net/flash/yalitimhesabi.swf?" + new Date().getTime()); //this will avoid caching old swf.

我在 EXE 投影仪上进行了测试,它似乎可以工作。

【讨论】:

  • 安全问题已解决 :) 但现在在输出中:TypeError: Error #1009: Boş nesne başvuru özelliğine veya yöntemine erişilemiyor。在 asdfg_fla::MainTimeline/frame1() 我也不能在 swf 中做任何事情。
最近更新 更多