| | Flash - XML galleria fotografica ma anche di più, oltre alle foto possiamo aggiungere musica video e testi tutto quello che vogliamo | |
| |
| | |
| max_400 |
| | a richiesta per un mio amico ho fatto questa galleria esterna che prende le foto da una lista xml
| | |
| |
|
| max_400 |
| | file.xml CODICE <testo t="joe"><b>Singapore</b>Roma</testo> <foto1 f1="Gallina">http://digilander.libero.it/max_maxuell/gallina.jpg</foto1> <foto2 f2="Coniglietto">http://digilander.libero.it/max_maxuell/coniglietto.jpg</foto2> <foto3 f3="Gatto">http://digilander.libero.it/max_maxuell/gatto.jpg</foto3> <video d="Veline">veline.swf</video>
<musica s="touch me">http://max400scuola.altervista.org/a_esempi_febbraio10/s3.mp3 </musica> <musica2 s2="left outside alone">http://max400scuola.altervista.org/a_esempi_febbraio10/i-pod_enteframe1/left-sintesi3s.mp3</musica2> codice actionscript stop();
filexml = "file.xml"; ApriXML(); function ApriXML () { mioxml = new XML(); myarray = new Array(); mioxml.load(filexml); mioxml.onLoad = ElaboraXML; function ElaboraXML (success) { if (mioxml.loaded) {
//trace(mioxml); myText.text=mioxml; myarray = mioxml.childNodes; Dati(); delete myarray; delete mioxml; } }; };
// Funzione che prende i dati XML e li mette in degli Array function Dati () { // Array che contengono i Dati -----------------------
testo=new Array(); ttesto=new Array();
foto1=new Array(); ffoto1=new Array();
foto2=new Array(); ffoto2=new Array();
foto3=new Array(); ffoto3=new Array();
video=new Array(); dvideo=new Array();
musica=new Array(); smusica=new Array();
musica2=new Array(); smusica2=new Array();
//----------------------------- for (k=0; k<=myarray.length; k++) { if (myarray[k].nodeName == "testo") { ttesto.push(myarray[k].attributes.t); testo.push(myarray[k].childNodes.toString()); //----------------------------- }else if (myarray[k].nodeName == "musica") { smusica.push(myarray[k].attributes.s); musica.push(myarray[k].childNodes.toString()); //----------------------------- } else if (myarray[k].nodeName == "foto1") { ffoto1.push(myarray[k].attributes.f1); foto1.push(myarray[k].childNodes.toString()); //--------------------------------------------- } else if (myarray[k].nodeName == "foto2") { ffoto2.push(myarray[k].attributes.f2); foto2.push(myarray[k].childNodes.toString()); //--------------------------------------------- } else if (myarray[k].nodeName == "foto3") { ffoto3.push(myarray[k].attributes.f3); foto3.push(myarray[k].childNodes.toString()); //--------------------------------------------- } else if (myarray[k].nodeName == "musica2") { smusica2.push(myarray[k].attributes.s2); musica2.push(myarray[k].childNodes.toString()); //--------------------------------------------- } else if (myarray[k].nodeName == "video") { dvideo.push(myarray[k].attributes.d); video.push(myarray[k].childNodes.toString()); }}} on (press) { _root.cucu.loadMovie(_root.foto1); _root.etichetta=_root.ffoto1; }on (press) { _root.cucu.loadMovie(_root.foto2); _root.etichetta=_root.ffoto2; }on (press) { _root.cucu.loadMovie(_root.foto3); _root.etichetta=_root.ffoto3;
}infine una casella dinamica con nome var: etichetta
| | |
| |
|
| 1 replies since 16/5/2010, 15:02 232 views |
| |
| | |