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
|
//Nouveau xml
var imglist = new XML();
//On ignore les blancs dans le xml
imglist.ignoreWhite = true;
//Quand la liste est chargée
imglist.onLoad = function() {
createGalerie();
};
//On charge
imglist.load("getImgList.php");
//Création de la galerie
t=0;
function createGalerie() {
//liste des images
var noeuds = imglist.firstChild.childNodes;
//On parcours la liste
for (var i = 0; i<noeuds.length; i++) {
t++;
//nom de l'image
var nom = noeuds[i].attributes.name;
//On crée un clip vide et le positionne
var img = this.createEmptyMovieClip("img"+i, i);
img._x = (i%t)*110+10;
img._y = Math.floor(i/t)*110+50;
//On charge la miniature
var view = img.createEmptyMovieClip("view", 0);
view.loadMovie("mini/"+nom);
//On enregistre les infos
img.nom = "images/"+nom;
img.width = noeuds[i].attributes.width;
img.height = noeuds[i].attributes.height;
//On affiche l'image dans un popup lors du clic
img.onRelease = function() {
popup(this.nom, this.width, this.height);
}
}
} |
Partager