javascript animation eating all memory

Discussion in 'Javascript' started by gencode, Aug 28, 2006.

  1. gencode

    gencode Guest

    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 there a better way to it or
    free the last process ran...please help :D

    // The following script implements rotating and fading the merchant
    // 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(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){'blendTrans(duration=2)''blendTrans(duration=crossFadeDuration)'
    document.images.SlideShow.src = preLoad[j].src
    if (document.all){
    j = j + 1
    if (j > (p-1)) j=0
    t = setTimeout('runSlideShow()', slideShowSpeed)
    gencode, Aug 28, 2006
    1. Advertisements

  2. gencode

    gencode Guest

    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, Aug 28, 2006
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.