PDA

View Full Version : auto slide show


alflashy
04-01-2005, 02:19 PM
hi
i found this script on the forum to run my slide show auto change after 5 seconds.
works great
function setTimerCtrl()
{
autoTimer = 5000;
//5 seconds between pictures... Number of seconds * 1000...
clearInterval(intervalID);
//Clear the interval for auto slide
intervalID = setInterval(autoSlide, autoTimer);
//Set an interval for auto slide
}
function autoSlide()
{
_root.changePhoto(1);
}

but the problem is
it change the photo before it load.
i mean
on dial up internet it takes more than 5 seconds to load the photo and before it load the slide show keeps on running and move to next photo.

please give some suggestion
thanks

madgett
04-01-2005, 05:48 PM
You can use a MovieClipLoader. This way the time starts after the picture has been completely loaded. It would look something like this:
var loader_mcl:MovieClipLoader = new MovieClipLoader();
var loaderLis:Object = new Object();
loaderLis.onLoadInit = function() {
autoTimer = 5000;
//5 seconds between pictures... Number of seconds * 1000...
clearInterval(intervalID);
//Clear the interval for auto slide
intervalID = setInterval(autoSlide, autoTimer);
//Set an interval for auto slide
};
loader_mcl.addListener(loaderLis);
function autoSlide() {
_root.changePhoto(1);
}
function changePhoto(num:Number) {
loader_mcl.loadClip("someclip.jpg", someMovieClipContainer);
}