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 49 50 51 52 53 54 55 56 57 58 59
| function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
description = [];
thumbnails = [];
total = xmlNode.childNodes.length;
for (j=0; j<total; j++) {
description[j] = xmlNode.childNodes[j].childNodes[0].firstChild.nodeValue;
thumbnails[j] = xmlNode.childNodes[j].childNodes[1].firstChild.nodeValue;
thumbnails_fn(j);
}
firstImage();
} else {
content = "fichier non chargé!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images_V2.xml");
//*****************************************************************
function firstImage() {
cntner_img.loadMovie(thumbnails[0], 1);
desc_txt.text = description[0];
};
//*****************************************************************
_root.createEmptyMovieClip("cntner_img", 1);
cntner_img._y = 30;
cntner_img._x = 30;
//*****************************************************************
_root.createEmptyMovieClip("thumbs_all", 2);
thumbs_all._y = 30;
thumbs_all._x = 400;
function thumbnails_fn(i) {
trace("makeButtons : i = "+i);
Mc_clip = thumbs_all.attachMovie("thumb_bout", "thumb_bout"+i, 100+i);
Mc_clip._x = i%3*120;
Mc_clip._y = Math.floor(i/3)*120;
McLoader = Mc_clip.createEmptyMovieClip("loader_Bar", 1000+i);
my_listener = new Object();
my_listener.onLoadProgress = function(mc:MovieClip, loadedBytes:Number, totalBytes:Number) {
pourcent_txt.text = Math.round((loadedBytes/totalBytes) * 100)+ "%";
};
my_listener.onLoadInit = function(target_mc) {
target_mc.onRelease = function() {
cntner_img.loadMovie(thumbnails[i], 1);
desc_txt.text = description[i];
};
};
//*****************************************************************
my_McLoader = new MovieClipLoader();
my_McLoader.addListener(my_listener);
my_McLoader.loadClip(thumbnails[i], McLoader);
}; |
Partager