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 42 43 44 45 46 47 48
|
tabimage = new Array();
XMLimage = new XML();
XMLimage.ignoreWhite = true;
XMLimage.onLoad = function() {
//masquer le clip de base
_root.cadre._visible = 100;
//définir nombre d'image par ligne
colonne = 4;
//remplir le tableau avec toutes les balises comprises dans <images></images> du XML
tabimage = XMLimage.firstChild.childNodes;
//boucler autant de fois qu'il y a de balises photo
for (i=0; i<tabimage.length; i++) {
//dupliquer le clip
_root.cadre.duplicateMovieClip("cadre"+i, i*1+5000);
// trace(XMLimage.firstChild.childNodes[i].childNodes[0].firstChild);
trace (XMLimage.firstChild.childNodes[i].attributes.url);
//on attache la photo au clip "glu" (celui qui a une position bizarre)
_root["cadre"+i].glu.loadMovie(XMLimage.firstChild.childNodes[i].childNodes[0].firstChild);
//attacher la description texte à la photo correspondante
_root["cadre"+i].textes = (XMLimage.firstChild.childNodes[i].childNodes[1].firstChild);
//positionner les images et leur cadre de la première ligne
if (i<colonne) {
_root["cadre"+i]._y = 50;
_root["cadre"+i]._x = 100*i+50;
//positionner les autres lignes par rapport a la précédente
} else {
_root["cadre"+i]._y = Number(_root["cadre"+(i-colonne)]._y)+100;
_root["cadre"+i]._x = _root["cadre"+(i-colonne)]._x;
}
_root["cadre"+i].onRollover=function(){
this._alpha=60;
}
_root["cadre"+i].onRollover=function(){
this._alpha=60;
}
}
};
XMLimage.load("portfolio.xml");
stop(); |