2011-04-05 35 views
0

我有一張從here(美國地圖)獲得的美國地圖。我目前從一個ActionScript文件中生成XML,然後想用我生成的XML作爲參數來顯示這個映射。據this,爲此在HTML需要以下聲明:通過加載器將參數傳遞給外部swf

world.swf?data_file=pathname/filename.xml 

我如何使用複製從ActionScript的裝載機這種行爲?現在我有:

var ldr:Loader = new Loader(); 
var url:String = "us/us.swf?data_file=senate.xml"; 
var urlReq:URLRequest = new URLRequest(url); 
ldr.load(urlReq); 
addChild(ldr); 

我想說明我已經看到this。但是,它似乎無法解決我的問題,因爲我無法編輯美國地圖swf。

回答

1

這聽起來像你想要的是使用URLVariables:

var variables : URLVariables = new URLVariables(); 
variables.data_file = "senate.xml"; 
urlReq.data = variables; 
+0

你說對了!非常感謝 - 我一直在搜尋互聯網,試圖找到答案,但我認爲我沒有正確解答這個問題。 :) – 2011-04-05 21:14:44

相關問題