1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| photos_xml = new XML();
photos_xml.ignoreWhite = true;
photos_xml.onLoad = function(ok) {
if (ok) {
noeuds = photos_xml.firstChild.childNodes;
nbrPhotos = noeuds.length;
premierePhoto = this.firstChild.firstChild;
dernierePhoto = this.firstChild.lastChild;
enCours = premierePhoto;
affichePhoto(enCours);
}
};
//on crée le clip vide dans lequel on va loader notre image (on le nomme container et on lui donne la première profondeur libre)
var conteneur:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
photos_xml.load("test.xml");
function affichePhoto(photo) {
conteneur.loadMovie(photo.attributes.fichier,ecran);
}
conteneur._x = 120;
conteneur._y = 17;
//bouton suivant
suivant.onRelease = function() {
if (enCours.attributes.num == nbrPhotos) {
enCours = premierePhoto;
} else {
enCours = enCours.nextSibling;
}
affichePhoto(enCours);
};
//bouton précédent
precedent.onRelease = function() {
if (enCours.attributes.num == 1) {
enCours = dernierePhoto;
} else {
enCours = enCours.previousSibling;
}
affichePhoto(enCours);
}; |
Partager