I'm using Flash CS3 and I need to modify an existing flash movie to get a variable fron an xml file called settings.xml and assign it to a variable called movieName. The existing movie uses Action Script 2.0.
It seems like it should be really simple (one line of code?), but I've tried about a dozen snippets of code and none seem to work.
Thanks in advance!!
Import a simple string variableAction Script 2.0 variable from xml file
Page 1 of 1
1 Replies - 4868 Views - Last Post: 05 August 2007 - 09:29 PM
Replies To: Import a simple string variable
#2
Re: Import a simple string variable
Posted 05 August 2007 - 09:29 PM
This will load the first node's value into a variable. This is to give you an idea on how to read xml data in ActionScript
If the value isn't in the first child node you will need to loop through the file until you get to the node you are looking for.
function loadXML(loaded)
{
if (loaded)
{
xml = this.firstChild;
movieName = "";
movieName = xml.childNodes[0].childNodes[0].firstChild.nodeValue;
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onload = loadXML;
xmlData.contentType = "text/xml";
xmlData.load("settings.xml");
If the value isn't in the first child node you will need to loop through the file until you get to the node you are looking for.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|