3 Replies Latest reply on Jan 31, 2008 8:42 AM by Rick Gerard

    Pre loader to run once

    Rick Gerard Adobe Community Professional & MVP
      So I have this flash masthead with a bunch of nav features that lives on all pages of a site I've designed. I've created a working pre-loader. So far so good. Now I'd like to know if there's any way to detect whether the swf file has all ready been put in cache so that it doesn't run every time.

      The reason that I ask is that if I remove the pre-loader, then clear the cache, the flash based masthead takes a second or two to load on the first page, but then is instantly available on other pages. It's appears that it's only when the pre-loader is part of the swf file that the it forces a reload every time a page is revisited. Even when you use the back button.

      My html files are all in the site root directory. All html pages reference the same (and only) swf file in my root/media directory.

        • 1. Re: Pre loader to run once
          Rick Gerard Adobe Community Professional & MVP

          Is this even possible
          • 2. Re: Pre loader to run once
            Level 7
            I'm not really sure what your question is. If you want to employ a
            preloader, but not have a graphic appear when the file is already downloaded
            you could just do a bit of a hack, and wait for say half a sec before
            showing the graphic:

            var myLoader = new MovieClipLoader();
            var loadListener = new Object();
            var myTimer = 0;

            loadListener.onLoadProgress = function(target, lb, tb){
            if(getTimer() - myTimer > 500){
            //half second has elapsed - file is not in the cache - show the
            progress meter
            loadListener.onLoadStart = function(target){
            myTimer = getTimer();

            Dave -
            Head Developer
            Adobe Community Expert

            • 3. Pre loader to run once
              Rick Gerard Adobe Community Professional & MVP
              My pre-loader is actually a progress bar and a little movie that runs through the nav system for the site. What I want to check for is whether or not the swf file is all ready loaded. If it is, there's no reason to run the pre-loader again and display the progress bar and all the nav buttons lighting up. There's also no reason for the swf file to load again when you use the back button or when you navigate to another page that uses the same swf file.

              Before I had the pre-loader it seemed that the swf loaded on the first visit to the site but then always played from cache. With the pre-loader as part of the swf file every time the page changes the pre-loader re-loads the entire swf file.

              If you need to see the code I'll attach it.

              At any rate, I'll give your code a try and see if I can get this to work.


              I'll give your code a try.