2013-07-19 114 views
0

我想從as3中的鏈接調用swf。我在互聯網上搜索,我用這個代碼從鏈接加載外部Swf [As3]

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通話鏈接,但我不能做任何事情在瑞士法郎。在輸出閃存中出現安全錯誤。而我嘗試crossdomain.xml的東西,它沒有工作:S

+0

我認爲在Flash環境下本地測試時,你不能像這樣從互聯網上請求文件。嘗試上傳您的SWF文件到您的虛擬主機。 –

+0

但我需要.exe格式:S –

回答

2

該文件http://gurselgunacar.web44.net/crossdomain.xml不存在。你應該創建一個。
裝載程序將始終在目標服務器上查找crossdomain.xml文件。

+0

ı上傳但仍然相同。 <?xml version =「1.0」?> <?xml version =「1.0」?> <!DOCTYPE跨域策略SYSTEM「http://www.adobe.com/xml/dtds/cross-domain -policy.dtd「>

0


Humm。嘗試添加這些東西安全:

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投影機上測試,它似乎工作。

+0

安全問題解決了:)但現在輸出: TypeError:Error#1009:Boşnesnebaşvuruözelliğineveyayöntemineerişilemiyor。 \t在asdfg_fla :: MainTimeline/frame1() 我也不能在swf中做任何事情。 –