[SIZE=3][FONT=Times New Roman]I have a problem with the delay on my slideshow. On the slideshow the pictures are being loaded automatically from a xml file as in the Slideshow tutorial. I have a play, pause, next, and previous buttons. But for some reason when the next or previous buttons are pressed the delay does not restart but it just keeps loading the images faster or slower depending how the next or previous buttons are pressed. Does any body have any idea how to make the delay restart when the next and previous buttons are press. [/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]this is my code[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman][/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]delay = 3000;
mc_pause = false;
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(“images.xml”);
p = 0;
//-----------------------
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
arr_blurb = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
//arr_blurb* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
}
firstImage();
} else {
content = “file not loaded!”;
}
}
/////////////////////////////////////
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
//desc_blurb.text = arr_blurb[p];
picture_num();
if (mc_pause == false) {
slideshow();
}
}
} else {
p = 0;
firstImage();
}
}
function prevImage() {
if (p>0) {
p–;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
//desc_blurb.text = arr_blurb[p];
picture_num();
} else {
p = total-2;
nextImage();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[p];
//desc_blurb.text = arr_blurb[p];
picture_num();
if (mc_pause == false) {
slideshow();
}
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
// buttons! //////////////////////////////////////
but_play._visible = 0;
but_pause.onRelease = function() {
clearInterval(myInterval);
but_pause._visible = 0;
but_play._visible = 100;
mc_pause = true;
};
but_play.onRelease = function() {
myInterval = setInterval(pause_slideshow, delay);
but_pause._visible = 100;
but_play._visible = 0;
mc_pause = false;
};
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////////
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
}
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
[/FONT][/SIZE]