5 Replies Latest reply on Apr 16, 2010 9:15 AM by r_honey

    LoaderInfo event "Complete" not firing properly in FireFox

    r_honey Level 1

      I am working with Flash CS 4 with AS 3.0. I use the following code to hook into Loading complete for my stage:

       

      this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);

       

      The code works properly in IE 8.0 (Windows 7) and Chrome. I have Flash Player 10 installed and the movie is targeted for Flash Player 9. The movies are showing a random behavior on FireFox 3.5.3.

       

      You can have a look at: http://www.mobilekrantinetwork.com

      \The website is under construction. The top bar contains 7 small & 1 big flash movie. View the page first in IE or Chrome. Then see it in FF. The labels from the flashvars are not being picked up properly. The load Complete function is not working properly.

       

      I would request someone to confirm that the movies are behaving differently in Firefox than in the other 2 browsers. If need be, I can paste my code to help find out the root cause.

        • 1. Re: LoaderInfo event "Complete" not firing properly in FireFox
          Albert Zemba

          Hello,

           

          I am facing the exact same problem.

          Seems something related to the cache or the size of the swf file. I think my swf is too small to triger a ProgressEvent.PROGRESS event but still a Event.COMPLETE should be triggered.

           

          But I still don't have a solution for the problem..

          • 2. Re: LoaderInfo event "Complete" not firing properly in FireFox
            r_honey Level 1

            I think this issue is related to caching by FireFox, but I am not sure. Wonder why any Flash gurus around here did not made a suggestion as to what we might be doing wrong??

            • 3. Re: LoaderInfo event "Complete" not firing properly in FireFox
              Albert Zemba Level 1

              Hmm..

              I just found a workaround that seems to do the job. Copy / pasting the code bellow.

               

               

              this.loaderInfo.addEventListener(Event.COMPLETE, loadComplete);
              this.addEventListener(Event.ENTER_FRAME, enterFr);

               

              function loadComplete(event:Event):void
              {
                  this.removeEventListener(Event.ENTER_FRAME, enterFr);
                  this.gotoAndStop(2);
              }

               

              function enterFr(e:Event)
              {
                  if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal) {
                      loadComplete(null);
                  }
              }

              • 4. Re: LoaderInfo event "Complete" not firing properly in FireFox
                kglad Adobe Community Professional & MVP

                once a post has a response i don't check it.  so, if a less-experienced person starts responding to a thread, you rely on the original responder for better or worse.  there's no way to tell from a subject line whether the responder is providing a helpful response or not.

                 

                anyway, as you surmised the issue is your swf is loading before your complete listener executes.  so, you're listening for an event that's already occured and therefore won't be dispatched to a listener function.

                 

                the work-around will always work.  i think the author removed both listeners but just in case he didn't:  removing both listeners is important.

                 

                edit:

                oops, no he failed to do that.  so, remove that enterframe listener on the first loop whether all bytes are loaded or not:

                 

                this.loaderInfo.addEventListener(Event.COMPLETE, loadComplete);
                this.addEventListener(Event.ENTER_FRAME,  enterFr);

                 

                function  loadComplete(event:Event):void
                {
                   //  this.removeEventListener(Event.ENTER_FRAME, enterFr);

                this.loaderInfo.removeEventListener(Event.COMPLETE, loadComplete);
                     this.gotoAndStop(2);
                }

                 

                function enterFr(e:Event)
                {

                this.removeEventListener(Event.ENTER_FRAME,  enterFr);
                    if  (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal) {
                         loadComplete(null);
                    }
                }

                • 5. Re: LoaderInfo event "Complete" not firing properly in FireFox
                  r_honey Level 1

                  Hi kglad, you mentioned in your post, that the author failed to remove the listeners. As your reply was to my post, I was wondering how did you figure out that I failed to remove the listeners? Or you were replying to the code posted?

                   

                  In any case, thanks for your help.