5 Replies Latest reply on May 27, 2008 11:44 PM by stigbn

    SWFLoader timing issue

    stigbn
      I have a catalog where I am displaying a number of SWF files (movieclips). The SWF files are loaded dynamically using SWFLoaders, but sometimes the load operation does not complete, meaning that the complete event is never fired.

      As part of my debugging, I handled the Ioerror, httpstatus, open and init events. The event handlers were just incrementing som debug counters, but when I am doing this, the problem cannot be reproduced. So it looks like the tiny delay introduced by handling these events, makes the SWFLoader work.

      So is there a timing issue to be aware of when using a lot (30-40) loaders too fill a catalog?

      When I am not handling the extra events ( = introducing tiny delays) 1,2 or sometimes 10 items are missing because their load operation does not complete (and no, IO error event is not fired).

      When the extra event handlers are used, the problem disappears. Seems lilke a timing issue with the SWFLOader, or perhaps the flash Loader class which I believe is used internally by the SWFLoader ?

      Does anyone have any ideas as to how to solve this issue ?

      best regards Stig

      best regards Stig
        • 1. Re: SWFLoader timing issue
          ntsiii Level 3
          Do you understand that even though the loader is "complete", the contained application might not be ready?

          You should get a reference to the loaded content, and listen for its application_complete event.

          Tracy
          • 2. Re: SWFLoader timing issue
            stigbn Level 1
            Hi Tracy

            No I was not aware of that, but I see this as another problem. Right now the problem is the load operations that never completes (nor fails). I think it may have to do with some browser connection limits... Do you know of any events being fired when an "open connection" event fails because of connection limits ?

            Another problem related to what you mentioned is when you tell a movie clip to "gotoAndStop" at som frame. Then it takes a little while before the instances of the frame is initialized. I could not find any "complete" events to handle this, so righ now I use a solution where I wait a bit and then check if all childred are non-nul, and if not I wait again before checking again. This is a hack, but it works and I could not find any better solution - do you know a better way to ensure a frame is completely initialized after a gotoAndStop call ?
            • 3. Re: SWFLoader timing issue
              ntsiii Level 3
              Sorry, I do not do any Flash, wouldn't know a "frame" if it bit me on the butt..
              Tracy
              • 4. Re: SWFLoader timing issue
                slaingod Level 1
                Loading a bunch of external swf's can cause problems with the browser connections to the server apparently, as they are limited. You should stagger your loads based on the complete event. Once you receive the complete event you should be able to wait on the swfloader content for its complete/init event.
                • 5. Re: SWFLoader timing issue
                  stigbn Level 1
                  ok thank you very much for your answers.

                  I will make some sequencing of the loads then, so that the next load operation is is started when the prev. completes/fails. However, is it possible to start a limited number of simultaneous loads?( and if so how many ?), or should I make the sequencing so, that the load operations run one at a time?

                  Then there is the comment about having to wait for the SWFLoader content to complete. When should I hook up with the the event on the content object, when SWFLoader fires init, or when it fires Complete ?