11 Replies Latest reply on Jun 4, 2010 11:13 AM by Laer2

    Swf file stays in cache and used in additional visits?

    Laer2 Level 1

      If I have 5 HTML pages, each with the SAME swf embedded in them (..and that swf has a preloader sequence at the start that cycles through a LOADING sequence, before continuing on with the rest of the movie, if all the frames are not loaded yet...), will visiting one of the other pages (after viewing a first one) result in the swf embedded in it to skip the preload sequence (since it would already be loaded in the browser cache), or would it have to load all the frames again, each time you visit one of the pages?

        • 1. Re: Swf file stays in cache and used in additional visits?
          kglad Adobe Community Professional & MVP

          if the swf files have the same name, it will be loaded from the user's cache (if they have one) on repeat loads

          .


          • 2. Re: Swf file stays in cache and used in additional visits?
            Laer2 Level 1

            So, then on subsequent visits to the other pages or the initial page, the preloader will be skipped?  (Again, assuming each HTML page has the same, one swf embedded into it)

            • 3. Re: Swf file stays in cache and used in additional visits?
              kglad Adobe Community Professional & MVP

              it won't be skipped unless that's the way you encoded it.  you can just expect it won't display for more than less than 1 second on reload.

              • 4. Re: Swf file stays in cache and used in additional visits?
                Laer2 Level 1

                Ya, well when I say preloader, I mean the standard one, where it loops within a LOADING screen if all the frames aren't loaded.

                 

                Only issue still is that since it's the same swf, it will always have the preloader... which means that there will be a minimum of 1 frame of the preloader (first frame of the preloader)... which wouldn't be the finished scene (all elements loaded).... So, it'll never be seamless when going from one HTML page to another.... The swf will always (at least) blink.  That's a bit of a drag... but I guess nothing can be done about that.... (...can it?)

                • 5. Re: Swf file stays in cache and used in additional visits?
                  kglad Adobe Community Professional & MVP

                  sure it can.  you just need to put your preloader on frame 2 and put code on frame 1 that checks for your swf's loadInfo's complete event.

                  • 6. Re: Swf file stays in cache and used in additional visits?
                    Laer2 Level 1

                    Can you have an initial swf which loads the main swf into a different level of that intial swf, and run a preloader IN THE INITIAL swf that references the frames loaded / total frames of the second swf that's now loaded within it?  Or, can a preloader only reference the swf/level that contains the preload code?

                     

                    If preload code can reference other swfs loaded into other levels, then I could have the main swf not have a preloader, but have the site START with an 'invisible' initial swf that loads the main swf into it, and waits until it is completely loaded (via preloader code in the INTIAL swf, not the main).  That way, it would be loaded into the browser cache before it is then used (visibly) by the real website....   That's assuming that theory works.  Not sure if you can do that.

                     

                    Basically, what I'm after is some way to have that swf be seamless when going from one page to another.... if possible.

                    • 7. Re: Swf file stays in cache and used in additional visits?
                      Laer2 Level 1

                      Hi, kglad... Ya, that's what I'm doing (which avoids having a Loading.... 100% flash on the screen for a frame... but it still means that frame 1's contents are shown, even if the preload code registers an 'everything loaded already'..... unless I'm mistaken.  Can the display of frame one be skipped if code on frame one tells it to jump to another frame?  Is the content of frame one not shown, regardless... and THEN jumps?

                      • 8. Re: Swf file stays in cache and used in additional visits?
                        kglad Adobe Community Professional & MVP

                        there shouldn't be any content on-stage in frame 1, just the code to check if loading is complete and, if it is, goto frame 3 or wherever your app starts.

                        • 9. Re: Swf file stays in cache and used in additional visits?
                          Laer2 Level 1

                          Ya, I see what you are saying....  Just might be a different case wtih what I have set up.  Hard to explain, but my swf is sort of an extension/piece of the 'interface' of the HTML (bitmap) page.... So, even with the 'nothing on the first frame' method, there would be a moment where part of the interface is missing...  But, you know what, chances are it'll be fast.... and besides, the bitmaps loading on the rest of the HTML will have a slight delay probably too....

                           

                          Just wish I could preload the swf before even going to the main webpage.... like by hiding it in my index.html page and preloading it.  Problem is, I'm assuming, that I'd have to have code inside the swf to check if it's loaded, then have it load the first webpage (where it first visibly appears).... but then that code would be in the swf of all the HTML pages, and would cause it to repeatedly load that first page in an endless loop!

                           

                          That's why I'm also asking if preloader code on one swf could reference a SECOND swf... either outside of the first, or loaded into a different level of the first swf.  If so, then I could just have a 'preloader' swf that loads the main swf, and then have it load the first HTML page (...and all the HTML pages would just have the main swf, and not also the preloader swf, like the index page would.

                           

                          But failing that, I just live with the delay.

                           

                          One other thing I thought of... Maybe I could have the background of the table cell that holds the swf set as a bitmap of the swf itself.  That way, an IMAGE of the swf appears first, and then the swf version appears on top of that once it's available.  That might work...

                          • 10. Re: Swf file stays in cache and used in additional visits?
                            Laer2 Level 1

                            It looks like you can, in fact, reference a second/external clip with a preloader, using event listeners.  Okay, so I have a few options now.

                            • 11. Re: Swf file stays in cache and used in additional visits?
                              Laer2 Level 1

                              Darn... Still having issues.

                               

                              My swf is structured like this:

                               

                              Frame 1: Blank... Checks if all frames loaded (to detect a revisit).  If so, jump to 'Loaded' label

                               

                              Frame 2: ('Preloader' label): Display preloader background and percentage display.  Check if all bytes loaded, if so jump to 'Reveal' label

                               

                              Frame 3: Go to 'Preloader' label

                               

                              Frame 4 ('Reveal' label): Main content appears in layers below  preloader background, preloader background slides away, revealing them.

                               

                              Frame 20 ('Loaded' label): Unobstructed main content

                               

                               

                              Theory here would be that on the first load, the preloader would kick in if needed (showing the load progress), then sliding away to reveal the main content.  If the connection is fast enough, it skips right up to the main content (no preloader screen or transition).  On return visits, since all pages are using the same swf (which should now be stored in the cache), all the frames should register as loaded, and so you just go straight to the unobstructed contect.

                               

                              A few flaws with that theory...

                               

                              1) Since the initial 'frames loaded' check is on the first frame, it would probably never register as having all frames loaded (unless you have a ridiculously fast connection).  Only time it (in theory) would work is on a revisit...

                               

                              2) ...which brings me to a newly discovered flaw in my logic.  Even with the swf in cache, it still needs to be 'loaded' (...it's just a lot faster than from the Internet... but nonetheless a non-instant 'load').  So, I would think now that you'd never get the initial 'frames loaded' scan seeing 'all frames loaded'.

                               

                              Ugh....

                               

                              Only solution I can think of is to extend the initial 'blank frame' (frame 1) to a few frames duration, and putting the initial 'frames loaded' check at the end of that, allowing a highspeed connection to fully load the cached swf by the time the inital check is performed..... but that would give you a longer gap before something appears...

                               

                              So, now I either have the preloader just 'pop' away (without a nice transition out)... or live with the preloader background appearing on entry of the page, and transitioning out.  I could actually live with the traditional 'door opens on arrival, door closes on leaving' routine... if only the main content actually changed in some way (justifying the doors closing).... But, since it's the same swf being used each time, the content is identical.

                               

                              Just looks like I'll have to accept a compromise of one type or another...