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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preloader With XML 1

Status
Not open for further replies.

ksbigfoot

Programmer
Apr 15, 2002
856
CA
I am using Flash 8.
I am creating a slideshow by using an XML file to say which images I want to use.
I am able to load the images into my slideshow and display them.
My question is how can I set it so that 80% of the pictures have loaded into my player before I allow my slideshow to start? Maybe showing the percentage of pictures that have loaded.
Can someone point me in the right direction.
Here is the code I am currently using
Code:
function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		description = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
			description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
		}
		GoToNextFrameAndDisplayLoaded();
	} 
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("XML/FeatureSlideshow.xml");
this.onEnterFrame = function() {
	filesize = picture.getBytesTotal();
	loaded = picture.getBytesLoaded();
	if (picture._width > 500) {
		picture._x = 0;
	} else {
		picture._x = 100;
	}	
	if (loaded == filesize) {
		if (picture._alpha<100) {
			picture._alpha += 5;
		}
	}
};
 
Your code must be individually preloading picture after picture and on demand as these do...




The preloading wait time, if you're going to preload 80% of all your pictures, is going to be much longer...

At least with the above, each picture is displayed once it's fully loaded...

Regards. Web Hosting - Web Design
01/07/07 -> OLDNEWBIE VS JOSHUA MUSSLEWHITE
 
Howdy oldnewbie,
Star to you. I was wondering if that was the case.
I was following kirupa's examples.
Thanks again,
ksbigfoot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top