|
-
Oct 29th, 2003, 12:13 PM
#1
Thread Starter
Hyperactive Member
random images from folders..need help.
can someone look at this and tell me why its not working?
Code:
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000
// Duration of crossfade (seconds)
var crossFadeDuration = 3
var t
var img
var iNdx
var sVal
var q = 0
var rpics = 0
var preLoad = new Array()
function loadshow(){
iNdx = Math.round(Math.random() * 3) + 1
for (y=1;y<=4;y++) {
sVal = "images/random" + iNdx + "/"
for (x=1;x<=4;x++) {
img = sVal + "random" + x + ".jpg"
preLoad[rpics] = new Image()
preLoad[rpics].src = img.src
rpics++
iNdx++
}
}
function runSlideShow(){
if (document.all){
document.images.SlideShow.style.filter="blendTrans(duration=2)"
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
document.images.SlideShow.filters.blendTrans.Apply()
}
document.images.SlideShow.src = preLoad[q].src
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play()
}
q = q + 1
if (q > (rpics-1)) q=0
t = setTimeout('runSlideShow()', slideShowSpeed)
}
-
Oct 29th, 2003, 01:25 PM
#2
Frenzied Member
If you could post the code for the whole page I might be able to work it out. Alternativly, you could just describe excatly how you want the script and I'll write it.
-
Oct 29th, 2003, 01:34 PM
#3
Thread Starter
Hyperactive Member
http://www.brentwoodacademy.com/indextest.shtml
that is where you can see the rest of the page
is what the script does is this:
4 random folders named random1, random2, random3, random4.
so it then picks a random folder then
loads four images from that folder into an images array
then loads the remaining folders after that in the sequence
then when its ran it runs a slideshow script body_onload then shows the images array.
-
Oct 29th, 2003, 01:41 PM
#4
Don't know if this is the problem or not, but iNdx is being incremented in the loop for your x var, which I think is the pictures.
Also, I don't see how iNdx is reset after reaching the last folder (folder4).... If it starts with Random3, then it will try to then load from Random4, then Random5 and then Random6.... there doesn't appear to be any check for when iNdx exceeds its limits.
TG
-
Oct 29th, 2003, 02:15 PM
#5
Thread Starter
Hyperactive Member
i was being a nub and forgot to add back the line:
Code:
if (iNdx==5) iNdx=1
after the line:
Code:
for (y=1;y<=4;y++) {
I initially took it out for debugging. Any ideas here?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|