i am trying to have one XML file for my flash movie, in it would be the menu and page info.
But it doesn’t work.
XML:
<?xml version="1.0" encoding="utf-8"?>
<config>
<navigation>
<menuItem>
<linkCat>menu</linkCat>
<btnName>Home</btnName>
<btnLink>content/home.swf</btnLink>
</menuItem>
<menuItem>
<linkCat>menu</linkCat>
<btnName>Services</btnName>
<btnLink>content/services.swf</btnLink>
</menuItem>
<menuItem>
<linkCat>menu</linkCat>
<btnName>Manual</btnName>
<btnLink>content/manual.swf</btnLink>
</menuItem>
<menuItem>
<linkCat>menu</linkCat>
<btnName>Contact</btnName>
<btnLink>content/contact.swf</btnLink>
</menuItem>
</navigation>
<sections>
<clientDetails>
<client>James</client>
<projectName>HotJim</projectName>
<clientManual>content/pdf/test.pdf</clientManual>
</clientDetails>
<serviceDetails>
<services>
<serviceType>electrical</serviceType>
<description>blablablah.</description>
</services>
<services>
<serviceType>IT</serviceType>
<description>blablablah.</description>
</services>
</serviceDetails>
<companyDetails>
<address>1</address>
<phone>2</phone>
<fax>3</fax>
<web>4</web>
</companyDetails>
</sections>
</config>
AS:
function loadXML(loaded) {
if (loaded) {
var xmlMenu = this.firstChild.firstChild;
menuCat = [];
btnName = [];
btnLink = [];
// Client Details
var xmlClient = xmlMenu.nextSibling;
client = [];
projectName = [];
clientManual = [];
totalMenu = xmlMenu.childNodes.length;
for (i=0; i<totalMenu; i++) {
menuCat* = this.firstChild.firstChild.firstChild.nextSibling.childNodes*.childNodes[0].firstChild.nodeValue;
btnName* = this.firstChild.nextSibling.childNodes*.childNodes[1].firstChild.nodeValue;
btnLink* = xmlMenu.childNodes*.childNodes[2].firstChild.nodeValue;
trace(menuCat*);
trace(btnName*);
}
trace("MENU: "+xmlMenu.firstChild.nextSibling);
trace("MENU: "+xmlMenu.firstChild.nextSibling.childNodes[0]);
trace("MENU: "+xmlMenu.firstChild.nextSibling.childNodes[0].firstChild.nodeValue);
trace("");
totalClient = xmlClient.childNodes.length;
for (i=0; i<totalClient; i++) {
client* = xmlClient.childNodes*.childNodes[0].firstChild.nodeValue;
projectName* = xmlClient.childNodes*.childNodes[1].firstChild.nodeValue;
clientManual* = xmlClient.childNodes*.childNodes[2].firstChild.nodeValue;
}
trace("CLIENT: "+xmlClient);
trace("CLIENT: "+xmlClient.childNodes[0]);
trace("CLIENT: "+xmlClient.childNodes[0].firstChild.nodeValue);
//setupList();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("config.xml");