Passing params to an external swf via loader

放肆的年华 提交于 2019-12-25 03:12:26

问题


I have a map of the US acquired from here (called U.S. Map). I am currently generating XML from inside an ActionScript file, and would then like to display this map using my generated XML as the argument. According to this, to do this in html would require the following declaration:

world.swf?data_file=pathname/filename.xml

How can I replicate this behavior using the Loader from ActionScript? Right now I have:

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);

I'd like to note that I've already seen this. However, it doesn't seem to be able to solve my problem, since I can't edit the US Map swf.


回答1:


It sounds like what you want is URLVariables:

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


来源:https://stackoverflow.com/questions/5558369/passing-params-to-an-external-swf-via-loader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!