
Welcome Guest
|
|
|
#1
|
|||
|
|||
|
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;
}
} |
|
#2
|
||||
|
||||
|
Hi!
I assume that the image Array contains all the url to the image ... well, if u hav these, u can make a loop to load all image. u can use MovieClipLoader Class to load the image then if done, loop again to load the next image.
__________________
there are 10 types of people in this world... those that understand binary and those that dont. ___________________________________________ Jiggie |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |

Other Programming



