Well I’m trying to make an slideshow with an variable timer in it that loads pictures out of an XML document.
Well the timer works, but the part about loading images and text into the slideshow, well that part just won’t work. And that’s strange because the timer retrieves his data from the XML document also…
this is the script for loading the XML into array’s
stop();
//XML////////////////////////////////////////////
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
dia = [];
beschrijving = [];
timer = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
dia* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
beschrijving* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
timer* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
}
gotoAndPlay(2);
slide();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("RWE slideshow.xml");
//variables//////////////////////////////////////
p = 0;
overgang_p = 0;
then this is the script for the preloader and for switching the images, note that the timer(an interval) is build in inside the preloader,
stop();
//variables//////////////////////////////////////
_global.beschrijving = beschrijving[p];
T = timer[p];
t = T*0.59;
//preloader//////////////////////////////////////
loaded = Math.round(_root.getBytesLoaded());
filesize = Math.round(_root.getBytesTotal());
total_percent = (loaded/filesize)*100;
_root.loaded_text = Math.round(total_percent);
if (loaded === filesize) {
preloader._visible = false;
preloader_txt._visible = false;
beschrijving_mc._visible = true;
beschrijving_txt._visible = true;
preloader_bg._visible = false;
if (beschrijving_logo._alpha<90) {
beschrijving_logo._alpha += 10;
}
ID = setInterval(function () {
gotoAndPlay(3);
nextImage();
}, t);
} else {
preloader._visible = true;
preloader_txt._visible = true;
beschtijving_mc._visible = false;
beschrijving_txt._visible = false;
if (beschrijving_logo._alpha>0) {
beschrijving_logo._alpha -= 10;
}
reloader_bg._visible = true;
}
//image switching////////////////////////////////////
function slide() {
if (loaded_bytes == loaded_total) {
container_mc.loadMovie(image[p], 1);
beschrijving_txt.text(beschrijving[p]);
T = timer[p];
}
}
function nextImage() {
if (p === total) {
p--;
} else {
p++;
}
}
and this is the part for clearing the interval so it won’t repeat itself until the new picture is loaded,
clearInterval(ID);
the description area(the dynamic text field) is inside a movieclip…but I have no clue about how I should get the right data into there.
Oh, every part of code is on an different frame(1,2,3) the .fla file is to big for an attachement so maybe I will post an link here if requested…
Help would really be appreciated