I have this code:
var x:XML = new XML();
x.ignoreWhite = true;
var urls:Array = new Array();
var captions:Array = new Array();
var whatday:Number;
x.onLoad = function() {
var photos:Array = this.firstChild.childNodes;
for(i=0;i<photos.length;i++) {
urls.push(photos*.attributes.url);
captions.push(photos*.attributes.caption);
}
holder.loadMovie(urls[0]);
caption.text = captions[0];
}
x.load(“january2009.xml”);
day1.onPress = function(){
holder.loadMovie(urls[0]);
caption.text = captions[0];
}
day1.onPress = function(){
holder.loadMovie(urls[1]);
caption.text = captions[1];
}
which I have taken off of another learning site online.
I am trying to edit the code, but every time I do, I get strange, or no, results.
I understand all of the code, believe it or not, except for this part:
x.onLoad = function() {
var photos:Array = this.firstChild.childNodes;
for(i=0;i<photos.length;i++) {
urls.push(photos*.attributes.url);
captions.push(photos*.attributes.caption);
}
I don’t know what a “for” loop does
I don’t understand what the lower case “i” is referring to.
I don’t know what push is or what the entire line of code there means.
I am trying to create an xml menu where there are more buttons than just a previous and next (1, 2, 3, 4) buttons and each button loads the appropriate node content. Help!