A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [MX] Advanced pre-loader problem.

  1. #1
    GamerGirl Liallan's Avatar
    Join Date
    Nov 2001
    Location
    the Netherlands
    Posts
    127

    [MX] Advanced pre-loader problem.

    Hi All.
    I'm using the following script in the preloader of the menu of my website. The problem is that everytime the user gets on the main page (wich is quite often) you get the preloader again (very short but still). I would like the preloader to be hidden once the file is loaded and cached after the first visit.
    Does anyone have an idea about how to solve this?
    Code:
    on frame 1:
    
    loadpercent = "0%";		
    loadBytes = "0 of " + Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000 + " Kb";
    
    on frame 2:
    gotoAndPlay(2);
    
    and some code to get a loading  bar wich isn't really relevant I think
    illustrator / concept artist / animator
    www.elsakroese.com

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    everytime the user gets on the main page
    you mean you actually go to other pages? as in: other urls?

    gparis

  3. #3
    GamerGirl Liallan's Avatar
    Join Date
    Nov 2001
    Location
    the Netherlands
    Posts
    127
    I don't fully understand what u mean but maybe this will clearefy.
    I got 1 mainpage wich links to other pages-other urls if you wish-, these pages link back to the mainpage, but everytime you go to the mainpage - either if its the first time or if you are linked back to the main from one of the bodypages - the preloader shows up again. Ofcourse only very briefly since the flash is technically already loaded but it still shows, wich imho looks less good.
    illustrator / concept artist / animator
    www.elsakroese.com

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    by other url i mean other html documents (so different web adresses). Which would require a very different solution (cookies) than if you have only one swf at one web address (variable).

    gparis

  5. #5
    GamerGirl Liallan's Avatar
    Join Date
    Nov 2001
    Location
    the Netherlands
    Posts
    127
    yeah there are other html documents (or php documents in my case).
    But the main page I'm talking about, with the flash menu, is just one page wich you keep returning to trough other pages.
    www.elsakroese.com/mainpage.php this might explain a bit.

    Issn't it possible to make a preloader that detects if it's file is already fully loaded and than just skips the loading phase?
    illustrator / concept artist / animator
    www.elsakroese.com

  6. #6
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    That's what your preloader does, it checks if _level0.getBytesLoaded() is equal to _level0.getBytesTotal(). So that's exactly what you have right now. But that is not enough apparently.

    What you want to know is if the user has already been on that url. As i said before, you may need to use cookies. Flash has a way to acheive that with the Shared Object method.

    gparis

  7. #7
    GamerGirl Liallan's Avatar
    Join Date
    Nov 2001
    Location
    the Netherlands
    Posts
    127
    So what your saying is that it should already be hidden the 2nd time you go to the page with the code I use now? o.0
    I sadly have no idea why its not doing that though. (lets say if u go from mainpage, to illustrations and back to main page, the loader shows again and it gets annoying after a few times)
    I will look into the cookie options but I wonder if I shoudn't be able to fix it in the sfw itself.. something wrong with my code perhaps? seems to work fine for the rest.
    illustrator / concept artist / animator
    www.elsakroese.com

  8. #8
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    no, your code is fine. But a i was saying, Flash is not a server side program, and as each time you go back, you loading that page again, and the swf with it, there is a delay for the flash to realise that getBytesLoaded must be equal to at 100% of the total. The delay is normal, and only if the php tells the flash 'you've be here before, skip the preloader' or Flash reading a cookie (that would be a tad faster) you'll have that little 100% loaded showing.

    gparis

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center