LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-18-2005, 10:46 PM
rome rome is offline
Registered User
 
Join Date: Dec 2005
Posts: 4
Rep Power: 0
rome is on a distinguished road
Preloader for XML loaded picture slider

I created a script to load a picture slider using an XML database to load the pictures. Does anyone know how to create a dynamic preloader that will reveal the pictures once all of them have fully loaded? The code is written below:

Code:
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("food.xml");
/////////////////////////////////////
function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		widths = [];
		totalwidths = [];
		totalwidths[0] = 0;
		piclocation = [];
		total = xmlNode.childNodes.length;
		for (i=0; i<total; i++) {
			image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
			widths[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
		}
		for (i=0, count=0, j=1; i<total; i++, j++) {
			y = widths[i] - 0;
			count = count+ y + 3;
			totalwidths[j] = count;
		}
		loadimages();
	} 
};
function loadimages() {
	widths = [];
	var totalwidth = 0;
	for (i=0;i<total; i++) {
		var picref = this.createEmptyMovieClip("container"+i,i);
		picref.loadMovie(image[i]);
	}
	setLocation();
};
function setLocation() {
	for (i=0; i<total; i++) {
		var contain = "container"+i;
		setProperty (contain,_x,totalwidths[i]);		
	} 
};
////////////////// button functions
this.onEnterFrame = function() {
	var rightposition = (700 - 344 - totalwidths[total]);
	if (_root.nav.contents._x >= -344) {
		tellTarget ("_level0.nav.scroller.scroll_right") {
			gotoAndStop(1);
			enabled = false;
		}
	} else {
		tellTarget ("_level0.nav.scroller.scroll_right") {
			enabled = true;
		}
	}
	if (_root.nav.contents._x <= rightposition) {
		tellTarget ("_level0.nav.scroller.scroll_left") {
			gotoAndStop(1);
			enabled = false;
		}
	} else {
		tellTarget ("_level0.nav.scroller.scroll_left") {
			enabled = true;
		}
	}
};
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to load a html website after preloader has loaded activecoder Actionscript 2.0 0 05-28-2009 06:51 PM
trying to bypass basic preloader if movie already loaded spindrift Flash CS3 / Flash 9 0 10-25-2008 04:08 PM
Preloader problem - preloader only shows up when 75% of movie's loaded HarveyC Flash MX 2004 6 03-25-2007 07:58 PM
Preloader for Randomly loaded clips stevenhanton Flash MX 2004 0 12-05-2004 10:13 PM
how to really find out if a picture is loaded schlumpf Flash MX ActionScript 9 10-21-2002 04:34 PM




All times are GMT. The time now is 10:42 PM.