Skip to main content
November 15, 2007
Question

Flash Loading XML

  • November 15, 2007
  • 1 reply
  • 207 views
I'm familiar with loading XML in Flash, presently working on a project that loads XML from a URL.

What I'm wondering is how do I setup the load statement in Flash so that I can load a dynamic URL?

For example a standard loading statement for XML is:

my_xml.load(" http://www.myurl.com/data.xml");

What would I do if I want the data.xml end of that URL to be dynamic? So that it might read - my_xml.load(" http://www.myurl.com/h/data?i=10");

where i=10 represents the XML file to load.

That variable will need to be assigned on page preceeding the XML, but I don't know how to do this, since Flash needs to know what URL to load the XML from before getting to the load statement.

I apologize if it sounds confusing, and appreciate any help.


Thanks,
Nathan
This topic has been closed for replies.

1 reply

Damon Edwards
Inspiring
November 15, 2007
append a variable to the URL string and update that variable as needed.. EX:

var URL:String = " http://www.myurl.com/data.xml";
var appendMe:String;

AS2:
my_btn.onRelease = function(){
appendMe = "i=10";
my_xml.load(URL+appendMe);
}

AS3:
my_btn.addEventListener(MouseEvent.CLICK, btnClicked);
function btnClicked(event:MouseEvent):void{
appendMe = "i=10";
my_xml.load(URL+appendMe);
}