Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gallery with preload iin every image

Status
Not open for further replies.

Greenleaf

Programmer
Feb 14, 2002
93
IT
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?

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;
		}
	}
};
 
I can see the preloaders bar one at a time, how can I see them simoultaneously? also I suppose that photos are loaded one at a time, so maybe this behaviour is normal
 
In fact it appears that some pictures get loaded simultaneously but the bar appear just whe the loading starts. I cannot understand, the bar has a frame so even when the byte loaded are 0, I should be able to see at least the frame.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top