cryptic_star
cryptic_star

Reputation: 1873

Passing params to an external swf via loader

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.

Upvotes: 0

Views: 210

Answers (1)

jhocking
jhocking

Reputation: 5577

It sounds like what you want is URLVariables:

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

Upvotes: 1

Related Questions