spoakes2000
08-09-2006, 04:28 PM
I'm trying to get a unique URL assigned to each button, but they all end up with either the same URL or "undefined". What am I doing wrong? Any suggestions on how to set up the button mc would be appreciated too.
menuXml = new XML();
menuXml.onLoad = headerLoad;
menuXml.load("myData.xml");
menuXml.ignoreWhite = true;
function headerLoad(success) {
if (success == true) {
buttonNode = menuXml.firstChild.firstChild;
currentButtonNode = buttonNode;
// total number of buttons
buttonItems = menuXml.firstChild.childNodes;
maxButtons = buttonItems.length;
// call function
buttonLoop(currentButtonNode);
}
}
function buttonLoop(currentButtonNode) {
for( i = 0; i<maxButtons; i++){
buttonText = currentButtonNode.attributes.lableText;
buttonURL = currentButtonNode.attributes.link;
var bt = this.attachMovie("mc", "button" + i, i);
menuColor = new Color(bt.colorBk);
menuColor.setRGB(currentButtonNode.attributes.btCo lor);
bt._y = (i+460)+ (i * 35);
bt._x = i + 165;
bt.label_txt.text = buttonText;
bt.button_btn.onRelease = function() {
getURL(buttonURL, "_self")
}
currentButtonNode = currentButtonNode.nextSibling;}
};
menuXml = new XML();
menuXml.onLoad = headerLoad;
menuXml.load("myData.xml");
menuXml.ignoreWhite = true;
function headerLoad(success) {
if (success == true) {
buttonNode = menuXml.firstChild.firstChild;
currentButtonNode = buttonNode;
// total number of buttons
buttonItems = menuXml.firstChild.childNodes;
maxButtons = buttonItems.length;
// call function
buttonLoop(currentButtonNode);
}
}
function buttonLoop(currentButtonNode) {
for( i = 0; i<maxButtons; i++){
buttonText = currentButtonNode.attributes.lableText;
buttonURL = currentButtonNode.attributes.link;
var bt = this.attachMovie("mc", "button" + i, i);
menuColor = new Color(bt.colorBk);
menuColor.setRGB(currentButtonNode.attributes.btCo lor);
bt._y = (i+460)+ (i * 35);
bt._x = i + 165;
bt.label_txt.text = buttonText;
bt.button_btn.onRelease = function() {
getURL(buttonURL, "_self")
}
currentButtonNode = currentButtonNode.nextSibling;}
};