Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Apr 2003
    Location
    Northern California
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    preloading with a loop

    Well as I'm sure I've said this before but I am working on a slide show and have hit a wall! I am using a loop to prelaod the images
    and the image source itself.

    [i]
    pix=[];
    for(i=0,j=1;i<42,j<43;j++,i++){
    pix[i]=new Image();
    pix.src=((j<10)?"000":"00")+j+".jpg";}



    The problem that I am having is that its still loading images even though they are preloaded(or so I think?).But I may be wrong I am just basing this on the fact that every time it changes an images the cursor changes to hourglass? I not quite sure what to think? Heres a link to the slideshow. Thanx for the help!
    SlideShow
    -When you do things right, people won't be sure you've done anything at all

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    maybe the browser is set to check for newer versions on "Every visit to the page", I don't know if that has something to do with image preloads..

    just want to comment on your use of 2 iterators.
    well, you can use a single iterator...

    pix=[];
    for(i=0;i<42;i++){
    pix[i]=new Image();
    pix[i].src=(((i+1)<10)?"000":"00")+(i+1)+".jpg";}
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Regular Coder
    Join Date
    Apr 2003
    Location
    Northern California
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Good idea but a quick qusetion. What kind of difference would removing the second iterator?
    -When you do things right, people won't be sure you've done anything at all

  • #4
    Senior Coder
    Join Date
    Mar 2003
    Location
    OHIO
    Posts
    1,438
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I looked at your page and it sems to work fine. The only thing that did not appear to work is the "fade". MAC IE 5 and Netcape 7.........

    MNS

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Originally posted by scriptkeeper
    Good idea but a quick qusetion. What kind of difference would removing the second iterator?
    obviously faster since only 1 variable will be evaluated and incremented
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •