G
gencode
I have this bit if javascript and it animates an image well, the
problem is that the more it runs the more memory it eats on the client
machine. Can anyone help me make this not eat all avaliable memory,
notice the recurrision, that may be it...is there a better way to it or
free the last process ran...please help
<script>
// The following script implements rotating and fading the merchant
logos.
// Fade effect only in IE; degrades gracefully
// Set slideShowSpeed (milliseconds)
var(slideShowSpeed = 1)
// Duration of crossfade (seconds)
var(crossFadeDuration = 3)
// Specify the image files
var(Pic = New Array())
// to add more images, just continue
// the pattern, adding to the array below
Pic[0] = '1.jpg'
Pic[1] = '2.jpg'
Pic[2] = '3.jpg'
var(t)
var(j = 0)
var(p = Pic.length)
var(PreLoad = New Array())
for (i = 0; i < p; i++){
PreLoad( = New Image())
preLoad.src = Pic
}
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[j].src
if (document.all){
document.images.SlideShow.filters.blendTrans.Play()
}
j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runSlideShow()', slideShowSpeed)
}
</script>
problem is that the more it runs the more memory it eats on the client
machine. Can anyone help me make this not eat all avaliable memory,
notice the recurrision, that may be it...is there a better way to it or
free the last process ran...please help
<script>
// The following script implements rotating and fading the merchant
logos.
// Fade effect only in IE; degrades gracefully
// Set slideShowSpeed (milliseconds)
var(slideShowSpeed = 1)
// Duration of crossfade (seconds)
var(crossFadeDuration = 3)
// Specify the image files
var(Pic = New Array())
// to add more images, just continue
// the pattern, adding to the array below
Pic[0] = '1.jpg'
Pic[1] = '2.jpg'
Pic[2] = '3.jpg'
var(t)
var(j = 0)
var(p = Pic.length)
var(PreLoad = New Array())
for (i = 0; i < p; i++){
PreLoad( = New Image())
preLoad.src = Pic
}
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[j].src
if (document.all){
document.images.SlideShow.filters.blendTrans.Play()
}
j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runSlideShow()', slideShowSpeed)
}
</script>