Codice PHP:
leggi = function () {
nuovo = new XML();
nuovo.ignoreWhite = true;
file="img.xml";
path="./img/";
//path="./data/top_class/img/";
nuovo.load(path+file);
nuovo.onLoad = function(success) {
if (success) {
tot = this.childNodes.length;
etichetta1.text = this.childNodes[i].attributes.descrizione;
box1.loadMovie(path+this.childNodes[i].attributes.photo);
//xmlpag1=this.childNodes[i].attributes.xmlpag+adjust;
var xmlpag1:Number = Number(this.childNodes[i].attributes.xmlpag+adjust);
etichetta2.text = this.childNodes[i+1].attributes.descrizione;
box2.loadMovie(path+this.childNodes[i+1].attributes.photo);
xmlpag2=this.childNodes[i+1].attributes.xmlpag;
etichetta3.text = this.childNodes[i+2].attributes.descrizione;
box3.loadMovie(path+this.childNodes[i+2].attributes.photo);
xmlpag3=this.childNodes[i+2].attributes.xmlpag;
etichetta4.text = this.childNodes[i+3].attributes.descrizione;
box4.loadMovie(path+this.childNodes[i+3].attributes.photo);
xmlpag4=this.childNodes[i+3].attributes.xmlpag;
//trace(i);
} else {
trace("errore di lettura");
}
};
};
var i = 0;
var adjust = 6;
leggi();
su.onRelease = function() {
i--;
if (i>=0) {
leggi();
} else {
i = 0;
}
};
giu.onRelease = function() {
i++;
if (i+3<tot) {
leggi();
} else {
i = tot-4;
}
};