This xml menu code works in flash 6, but not in flash 8…
what am i missing?
Here is the Actionscript:
function loadXML(loaded) {
if (loaded) {
var xmlContent = this.firstChild;
menuContent = new Array();
for (var i = 0; i<this.firstChild.childNodes.length; i++) {
nextEntry = xmlContent.childNodes*;
menuContent* = [nextEntry.attributes.name, nextEntry.attributes.value];
}
//trace(menuContent);
menuLength = menuContent.length;
elementspacer = 1;
var menuItem, yPosition = 0;
createEmptyMovieClip("clipContainer", 1);
for (var i = 0; i<menuLength; i++) {
clipContainer.attachMovie("element", "menuItem"+i, i);
thisClip = clipContainer["menuItem"+i];
thisClip.menuname = menuContent*[0];
thisClip.destination = menuContent*[1];
thisClip._y = yPosition;
yPosition += Math.floor(thisClip._height+elementspacer);
}
} else {
trace("Error loading xml");
}
}
function setMenu(value) {
getURL("http://"+value, "blank");
}
importXML = new XML();
importXML.ignoreWhite = true;
importXML.onLoad = loadXML;
importXML.load("menu.xml");
Here is the XML:
<?xml version="1.0"?>
<select>
<option name="Google" value="www.google.com"/>
<option name="Yahoo!" value="www.yahoo.com"/>
<option name="Kirupa" value="www.kirupa.com"/>
</select>