I used the slideshow tutorial here on kirupa.com. However when I’m using Firefox and switching between tabs it stops showing the pictures. The script goes on and the commentary text is shown but the pictures just isn’t there. What am I doing wrong?
delay = 5000;
//-----------------------
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
p = 0;
this.onEnterFrame = function() {
filesize = bild.getBytesTotal();
loaded = bild.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
bild._width = 437;
bild._height = 283;
preloader._visible = false;
if (bild._alpha<100) {
bild._alpha += 10;
}
}
}
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
bild._alpha = 0;
bild.loadMovie(image[p], 1);
comment.text = description[p];
picture_num();
slideshow();
}
}
}
function firstImage() {
if (loaded == filesize) {
bild._alpha = 0;
bild.loadMovie(image[0], 1);
comment.text = description[0];
picture_num();
slideshow();
}
}
function picture_num() {
current_pos = p+1;
nummer.text = current_pos+" / "+total;
}
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
}
online ex:
http://www.rikardandersson.se/bildspel/index.html