Ho una gallery, che carica le immagini da un file XML.
Questo è il codice che ho sulla timeline di un mc:
Il file XML caricato ha una struttura del tipo:Codice PHP:stop();
this.mp._alpha = 0;
var numFadeRate = 5;
function imgSlide() {
onEnterFrame = function () {
this.mp._alpha -= numFadeRate;
if (this.mp._alpha<0) {
delete onEnterFrame;
this.mp.unloadMovie();
showRecord(loadNumber);
}
};
}
function show() {
onEnterFrame = function () {
this.mp._alpha += numFadeRate;
if (this.mp._alpha>100) {
delete onEnterFrame;
}
};
}
this.currentRecord = 0;
function dataLoaded(complete) {
if (complete) {
this.nodeCount = xmlObject.firstChild.childNodes.length;
showRecord(1);
}
}
xmlObject = new XML();
xmlObject.ignoreWhite = true;
xmlObject.onLoad = dataLoaded;
xmlObject.load("marketplace.xml");
function showNext() {
if (this.currentRecord == this.nodeCount) {
loadNumber = 1;
} else {
loadNumber = this.currentRecord+1;
}
imgSlide();
}
function showPrevious() {
if (this.currentRecord == 1) {
loadNumber = this.nodeCount;
} else {
loadNumber = this.currentRecord-1;
}
imgSlide();
}
function showRecord(recordNumber) {
var nodeObject = xmlObject.firstChild.childNodes[recordNumber-1];
media = nodeObject.attributes.media;
slideFilename = media+".jpg";
this.mp.loadMovie(slideFilename);
onEnterFrame = function () {
bytesLoaded = this.mp.getBytesLoaded();
if (bytesLoaded == this.mp.getBytesTotal()) {
delete onEnterFrame;
show();
}
};
this.currentRecord = recordNumber;
}
Il problema è che, cliccando i pulsanti per muoversi avanti / indietro - rispettivamente, con l'A.S. di seguito riportato:Codice PHP:<?xml version="1.0"?>
<mySlideShow>
<myImage media = "market01">
</myImage>
<myImage media = "market02">
</myImage>
<myImage media = "market03">
</myImage>
...
</mySlideShow>
Codice PHP:on (release) {
_root.showNext();
}
la gallery non scorre. La prima immagine viene regolarmente caricata, ma poi non accade nulla. In effetti, mi sembra che il problema consiste nel fatto che la stringa:Codice PHP:on (release) {
_root.showPrevious();
}
sembra non funzionare. Cioè, il texfield nodeCount non carica alcun valore, quindi - evidentemente - non registra il numero totale di nodi del file XML.Codice PHP:this.nodeCount = xmlObject.firstChild.childNodes.length;
Perchè?
Mi sto rimbecillendo, ma non riesco a vedere l'errore...
Please, help...
![]()

Rispondi quotando