dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: cache / preloader question

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Posts
    133

    cache / preloader question

    hi

    i have a holder mc into which i load various swfs, and i have a preloader mc tracking the load progress with a dyn txt / graphic readout. so far, so good..

    each swf replaces the previous one and so on. but when a swf is reloaded it takes the same amount of time to load as the first time. i would have thought that, as it has already been loaded once, it would be in the browser's cache and would therefore load again much more quickly the second time around..

    am i simply mistaken about this? or what could be going wrong? any ideas please..

  2. #2
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Depends a lot on the preloader. Some one frame types will reload a movie no matter what. It also depends on the amount of memory you have. maybe even some windows settings. Also, are you testing from a server, or just test movie?

  3. #3
    Senior Member
    Join Date
    Sep 2000
    Posts
    133
    hi

    thanks for your reply. i'm testing from the server, both at broadband and 56k speeds. the preloader is a 2 frame loop type.. i've included the script below. firefox and explorer both have 50mb cache, safari i don't know (can't find this info).

    using broadband everything seems to work ok. but testing at 56k and the results are somewhat different depending on the browser.

    if a movie is fully loaded (without its load progress being interrupted), it then appears whenever subsequently called without any problems. it does not reload but simply plays, as it should.

    however, if a movie's load progress is interrupted (ie, i've hit the menu button, which is scripted to unload the movie) then click to load the movie again, different things happen:

    in firefox, the preloader readout starts from wherever the movie was interrupted (ie, 12%). in safari, the preloader readout starts again from 0%. in explorer, either of the above might happen, or the preloader just fails and nothing happens!

    internet explorer's download progress readout suggests that a movie download continues even when the menu button (with unload movie script) is clicked, and the activity window in safari shows a similar thing:

    for instance, if a movie is 100kb, safari shows __% loading of 100kb first time round. if interrupted this still keeps loading, despite the menu button and even if another movie has been called.. therefore it is essentially loading 2 movies at the same time into the same movie holder!

    safari then shows __% loading of 200kb (for the first 100kb movie) and __% loading of 100kb for the second movie.

    also, firefox's download progress readout says 'transferring from www.myserver.com...' rather than 'done', even if the movie is completely downloaded.

    i'm definitely confused now..

    how can a movie still be loading if an unload movie script has been triggered?

    how can 2 movies seem to be loading at the same time into the same movie holder?

    why is data being transferred if the movie has completed loading?

    here is the preload script that i'm using. the preloader script is inside its own movie clip, rather than being on the swfHolder clip or inside the loading swf.

    fr1. stop();
    fr2. loadReadout = "0%";
    fr3. loadReadout = (Math.floor (_root.swfHolder.getBytesLoaded() / _root.swfHolder.getBytesTotal() * 100) + "%");

    if (_root.swfHolder.getBytesLoaded() == _root.swfHolder.getBytesTotal()){ loadReadout = "100%";
    this.gotoAndStop("end"); // preloader stops on fr5 ("end").
    _root.swfHolder.gotoAndPlay(2); // plays movie
    }
    fr4. gotoAndPlay("fr3");

    the menu button script (that unloads the movie) is:

    on (release) {
    unloadMovie("_root.swfHolder");
    _root.menu._visible = 1;
    this._visible = 0;
    }

    any ideas would be much appreciated, thanks a lot.

  4. #4
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,490
    Part of the problem is browser cache. Once the movie has downloaded, it's cached, if part of it has downloaded, part of it is cached. When it's called up again, it takes up from there, until the cache is emptied again, or the movie is replaced in cache by something else. I don't use firefox or safari, so I'll let someone else help on that, but the IE browser shouldn't show any kind of loading progress of a swf, only the html page it's embedded in.

    Your code looks ok, except you don't need quote marks in the unloadMovie parentheses.

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