Connecting Tech Pros Worldwide Forums | Help | Site Map

javascript animation eating all memory

gencode
Guest
 
Posts: n/a
#1: Aug 28 '06
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>


gencode
Guest
 
Posts: n/a
#2: Aug 28 '06

re: javascript animation eating all memory


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:
Quote:
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>
Closed Thread