PDA

View Full Version : random image slideshow


Kevin
01-26-2003, 12:30 AM
Is this design feasible?
Just took a shot at it but not sure if this is the right approach?
What I need to do is set up a timer for the length of the show and one that controls how ofter the images are displayed.

I think I have most of the parts here but not quite sure.

var MyPics = new Array()
if (document.images) {
MyPics[0] = new Image(288,288) // pre-cache slide images
MyPics[1] = new Image(288,288)
MyPics[2] = new Image(288,288)
MyPics[3] = new Image(288,288)
MyPics[4] = new Image(288,288)
MyPics[5] = new Image(288,288)

MyPics[0].src = "flower01.gif"
MyPics[1].src = "flower02.gif"
MyPics[2].src = "flower03.gif"
MyPics[3].src = "flower04.gif"
MyPics[4].src = "flower05.gif"
MyPics[5].src = "flower06.gif"
}

var indexSlide = 0;
var lastSlide = MyPics.length - 1;
var manual = 1;
function RandSlide()
{
var NxtSlide = Math.floor(Math.Random() * 7 );
document.Pix.src = MyPics[NxtSlide].src;
}
setInterval (setInterval("RandSlide()",2000),30000);

<INPUT onclick=RandSlide() type=button value=" << ">

I'm sure that there is something more to what I have attempted can you advise?

I also need to use a clearTimeout() to stop the timer if the user wishes to end the slide show and browse manually.

insight always appreciated

Thank You
Kevin:confused:

Mr J
01-26-2003, 04:32 PM
Not quite there .....

Take a look at the example in attachment.

It is something what i did for someone else a while back but sounds to be on the lines of what you are trying to create.

zoobie
01-26-2003, 05:38 PM
The problem with random slides-shows is just that...they're random. This means you'll see the same slide several times before actually seeing all of your images. What I'd do is make an semi-random slideshow where, if the image has already been viewed, to show a remaining one that hasn't. :p