I have an array that I’m using for a picture scroller and I want to have it presize my pictures. Is there a function that can do that? I understand programming, but I haven’t really looked at javascript that much. The code is:
var Slides = new Array(‘photos/bjpennkofactory.jpg’,’photos/cabbagekofactory.jpg’,’photos/danakofactory.jpg’,’photos/erin_t2.jpg’,’photos/forrestgriffith.jpg’,
‘photos/hammerkofactory.jpg’,’photos/jeremy_horn_KOfactory.jpg’,’photos/joerogankofactory.jpg’,’photos/kevinnaskkofactory.jpg’,’photos/mikenchuckliddel.jpg’,’photos/wessimmskofactory.jpg’,’photos/ufc_crew.jpg’);
function CacheImage(ImageSource) {
var ImageObject = new Image();
ImageObject.src = ImageSource;
return ImageObject;
}
function ShowSlide(Direction) {
if (SlideReady) {
NextSlide = CurrentSlide + Direction;
document.SlideShow.Previous.disabled = (NextSlide == 0);
document.SlideShow.Next.disabled = (NextSlide == (Slides.length-1));
if ((NextSlide >= 0) && (NextSlide < Slides.length)) {
document.images[‘Screen’].src = Slides[NextSlide].src;
CurrentSlide = NextSlide++;
Message = ‘Picture ‘ + (CurrentSlide+1) + ‘ of ‘ + Slides.length;
self.defaultStatus = Message;
if (Direction == 1) CacheNextSlide();
}
return true;
}
}
function Download() {
if (Slides[NextSlide].complete) {
SlideReady = true;
self.defaultStatus = Message;
}
else setTimeout(“Download()”, 100);
return true;
}
function CacheNextSlide() {
if ((NextSlide < Slides.length) && (typeof Slides[NextSlide] == ‘string’))
{
SlideReady = false;
self.defaultStatus = ‘Downloading next picture…’;
Slides[NextSlide] = CacheImage(Slides[NextSlide]);
Download();
}
return true;
}
function StartSlideShow() {
CurrentSlide = -1;
Slides[0] = CacheImage(Slides[0]);
SlideReady = true;
ShowSlide(1);
}