voilà le code et comme étant un noob en flash je me demandait comment
faire pour que le swf charge automatiquement la 1er image du xml. merci
d'avance
_root.INDICE = -1;
_root.PIC = new Array();
//ecouteurs sur chargement
Ec = new Object();
Ec.onLoadProgress = function(MCtarget, loadedBytes, totalBytes) {
_root.loadbar.percent = Math.floor(loadedBytes*100/totalBytes);
_root.loadbar.gotoAndStop(_root.loadbar.percent);
_root.loadbar.percent += "%";
};
Ec.onLoadInit = function(MCtarget) {
while (MCtarget._width>_root.cadre._width or MCtarget._height>_root.cadre._height) {
MCtarget._xscale -= 1;
MCtarget._yscale -= 1;
}
MCtarget._x = _root.cadre._x+(_root.cadre._width-MCtarget._width)/2;
MCtarget._y = _root.cadre._y+(_root.cadre._height-MCtarget._height)/2;
_root.loadbar.gotoAndStop(1);
_root.loadbar.percent = "";
};
//objet chargement
MCloader = new MovieClipLoader();
MCloader.addListener(Ec);
//objetXML
MCXML = new XML();
MCXML.load("cartes/amnord/photos.xml");
MCXML.ignoreWhite = true;
MCXML.onLoad = function(succes) {
function Pic_Desc(n, u) {
this.name = n;
this.url = u;
}
if (succes) {
var i = 0;
while (this.firstChild.childNodes[i] != undefined) {
_root.PIC[i] =
new Pic_Desc(this.firstChild.childNodes[i].attributes.nom,
this.firstChild.childNodes[i].attributes.url);
i++;
}
_root.MAX = i;
}
};
//boutons
B_next.onRelease = function() {
//chargement de l'image selectionnée
_root.INDICE++;
if (_root.INDICE == _root.MAX) {
_root.INDICE = 0;
}
_root.MCloader.loadClip(_root.PIC[_root.INDICE].url, "_root.holder");
_root.desc = _root.PIC[_root.INDICE].name;
};
B_previous.onRelease = function() {
//chargement de l'image selectionnée
_root.INDICE--;
if (_root.INDICE < 0) {
_root.INDICE = _root.MAX-1;
}
_root.MCloader.loadClip(_root.PIC[_root.INDICE].url, "_root.holder");
_root.desc = _root.PIC[_root.INDICE].name;
};