Ciao a tuuti,
ho un problema sulla customizzazione di un file flash che recupera dati da un file xml.
Codice del file flash
codice:
fileXml = "news.xml?rnd="+random(99999);
fileXml = "news.xml";
newsXml = new XML();
apparray = new Array();
newsXml.load(filexml);
newsXml.onLoad = Metti;
function Metti (success) {
if (newsXml.loaded) {
apparray = newsXml.childNodes;
Dati();
Position();
loaderxml = "";
}
;
}
;
function Position () {
newsMax = elementoNotizia.length;
for (i=0; i<=newsmax; i++) {
clipnews.attachMovie("tabNews", "tabNews"+i, i);
clipnews["tabNews"+i]._x = 174*i;
clipnews["tabNews"+i]._y = 0;
clipnews["tabNews"+i].data = elementoData[i];
clipnews["tabNews"+i].notizia = elementoNotizia[i];
}
;
}
;
function Dati () {
elementoData = new Array();
elementoNotizia = new Array();
for (k=0; k<=apparray.length; k++) {
if (apparray[k].nodeName == "news") {
elementoData.push(apparray[k].attributes.data.toString());
elementoNotizia.push(apparray[k].childNodes.toString());
}
}
;
}
;
il file xml che ho è il seguente:
codice:
<?xml version="1.0"?>
<news data="30/05/2002">“Internet is all about etablishing and reinforcing connections between people [...]” (J. Hagel III, A.G. Armstrong)</news>
<news data="02/05/2002">Scarica i nuovi sorgenti FLA open source.</news>
<news data="02/04/2002">Aggiornamento nel layout grafico del sito.</news>
<news data="02/03/2002">Nuove foto nella sezione PHOTO.</news>
Il mio problema è che il mio file xml è diverso.... ho fatto delle prove ma non riesco a estrarre niente...
codice:
<?xml version="1.0"?>
<news>
<titolo>Titolo della news</titolo>
<data>20/03/2003</data>
<immagine>img.jpg</immagine>
<abstract>“Internet is all about etablishing and reinforcing connections between people [...]” (J. Hagel III, A.G. Armstrong)</abstract>
<link>#</link>
</news>
<news>
<titolo>Titolo della news2</titolo>
<data>20/04/2003</data>
<immagine>img.jpg</immagine>
<abstract>“Prova 1 Internet is all about etablishing and reinforcing connections between people [...]” (J. Hagel III, A.G. Armstrong)</abstract>
<link>#</link>
</news>
<news>
<titolo>Titolo della news3</titolo>
<data>20/05/2003</data>
<immagine>img.jpg</immagine>
<abstract>“Prova 2 Internet is all about etablishing and reinforcing connections between people [...]” (J. Hagel III, A.G. Armstrong)</abstract>
<link>#</link>
</news>
Qualcuno può darmi una dritta? Sto facendo una gran confusione tra nodes childnodes e attributes.....