javascript animation eating all memory

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 :D

<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>
 
G

gencode

The memeory seems to be unloading now after each loop...maybe something
else was wrong, so I guess we can ignore this....sorry about that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top