I have been learning how to use arrays and have come across a problem that my learning style of trial and error hasn’t seemed to be able to solve. I have three different buttons in flash and am trying to get them to each load a different external webpage onRelease.The other stuff from the xml loads fine, but for some reason this keeps showing up as “undefined.” Why is that? (Learning is hard! )
importXML = new XML();
importXML.ignoreWhite = true;
importXML.onLoad = function(success) {
if (success) {
var root = this.firstChild;
for (var i = root.firstChild; i != null; i=i.nextSibling) {
aCaption.push(i.attributes.caption);
aImage.push(i.attributes.img);
aLink.push(i.attributes.link);
}
populate();
}
};
importXML.load("gallery2.xml");
var aCaption = new Array();
var aImage = new Array();
var aLink = new Array();
function populate() {
for (i=0; i<aCaption.length; i++) {
this["box"+(i+1)+"_txt"].htmlText = aCaption*;
this["image"+(i+1)+"_img"].loadMovie("images/"+aImage*);
this["link"+(i+1)+"_btn"].onRelease = function(){
getURL(aLink*, "_blank");
}
}
}
xml looks like this:
<option caption="Blue 1" img="image1.jpg" link="http://www.google.com"/>