[SIZE=2]Hey all, I was hoping someone could help me out with a bit of an Actionscript / XML issue.[/SIZE]
[SIZE=2]I currently have an SWF that is reading and displaying text, images and an ID number via an XML file. What I wanted to do was switch the text and graphic based on a URL.[/SIZE]
[SIZE=2]For example the if the url was www.somedomain.com/about/ the SWF would then read the XML file and see that based on the domain ID the “about” text and images would load.[/SIZE]
[SIZE=2]Any idea on how I could achieve this?[/SIZE]
[SIZE=2]Thanks in advance.
Here is what my Actionscript looks like
[/SIZE]
function loadXML(loaded) {
if (loaded) {
_root.headers = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
_root.subhead = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;
_root.image = this.firstChild.childNodes[0].childNodes[3].firstChild.nodeValue;
headline_txt.text = _root.headers;
subheadline_txt.text = _root.subhead;
picture_mc.loadMovie(image);
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("headers.xml");
[SIZE=2]
And my XML
[/SIZE]
<?xml version="1.0"?>
<headers>
<section>
<id>1</id>
<title>About</title>
<desc>A description will go here.</desc>
<image>images/bg1.png</image>
</section>
<section>
<id>2</id>
<title>Support</title>
<desc>Another description here.</desc>
<image>images/bg1.png</image>
</section>
</headers>
[SIZE=2]
[/SIZE]