Here is the problem.
I am loading links from an xml file into an array called myLinks, and the trace code shows that the links have been loaded. But the buttons will not pick up the links in the loop.
If I were to put the links directly into the myLinks array the buttons work perfectly.
Any ideas what I am doing wrong?
<?xml version="1.0" encoding="utf-8"?>
<mainNode>
<subNode1>http://www.ultrashock.com/</subNode1>
<subNode2>http://www.kirupa.com/</subNode2>
<subNode3>http://www.flashkit.com/</subNode3>
<subNode4>http://www.ultrashock.com/</subNode4>
<subNode5>http://www.kirupa.com/</subNode5>
<subNode6>http://www.flashkit.com/</subNode6>
<subNode7>http://www.ultrashock.com/</subNode7>
<subNode8>http://www.kirupa.com/</subNode8>
<subNode9>http://www.flashkit.com/</subNode9>
</mainNode>
// Creates a new XML Object
var thisXml:XML = new XML();
// Leave nodes that contain white space alone
thisXml.ignoreWhite = true;
// Loads the XML Document
thisXml.load("xml.xml");
// This function begins once the XML has been successfully received from the server
thisXml.onLoad = function() {
// Create the Array to hold our XML
var myLinks:Array = new Array();
// Loops through all the nodes in our XML file
for (var xNode:XMLNode = thisXml.firstChild.firstChild; xNode != null; xNode = xNode.nextSibling) {
// Load our subNodes into the Array
myLinks.push(xNode.firstChild.nodeValue);
// Close the Loop
}
// Trace the contents of our Array to the output window
trace(myLinks);
// Close the Load Function
}
var buttons:Array = new Array(fm1, fm2, fm3, fm4, fm5, fm6, fm7, fm8, fm9);
// loop to assign actions to buttons
for (var i:Number = 0; i<buttons.length; i++) {
// variable with reference to button
var mc:MovieClip = buttons*;
// set on release
mc.onRollOver = function() {
this.gotoAndPlay("play");
trace(this._name);
};
mc.onRollOut = function() {
this.gotoAndStop(1);
trace(this._name);
};
mc.id = i;
mc.onRelease = function() {
this.gotoAndStop("11");
getURL(myLinks[this.id],"_parent");
};
}