By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,384 Members | 1,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,384 IT Pros & Developers. It's quick & easy.

javascript animation eating all memory

P: n/a
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([i] = New Image())
preLoad[i].src = Pic[i]
}
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>

Aug 28 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.
gencode wrote:
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([i] = New Image())
preLoad[i].src = Pic[i]
}
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>
Aug 28 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.