Hello,
I am populating a gallery with photos whose path is defined in a xml file.
Then I would like to show a preload bar for every loading photo. The code I'm using doesn't show the bars simultaneously (sometimes I'm not even sure that the bar is shown), how can I do?
I am populating a gallery with photos whose path is defined in a xml file.
Then I would like to show a preload bar for every loading photo. The code I'm using doesn't show the bars simultaneously (sometimes I'm not even sure that the bar is shown), how can I do?
Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
icona = [];
image = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
icona[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
image[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
displayIcon();
//firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
function displayIcon() {for (index=0; index<total; index++) {
attachMovie("image","picture"+index,index,{_x:index*(160), _y:53});
_root["picture"+index].createEmptyMovieClip("dentro",0);
_root["picture"+index].dentro.loadMovie(icona[index],1);
_root["picture"+index].immagine = image[index];
_root["picture"+index].onPress = function() {
_level0.foto = this.immagine;
loadMovieNum("screen.swf", 4);
};
}*/
}
inside the image movieclip I write:
this.onEnterFrame = function() {
filesize = dentro.getBytesTotal();
loaded = dentro.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (this._alpha<100) {
this._alpha += 10;
}
}
};