1

I have used the below code.

stop();
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadingAction);
this.loaderInfo.addEventListener(Event.COMPLETE, onLoadedAction);
this.loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErroAction);
function onLoadingAction (e:ProgressEvent):void 
{
    trace("loading");   
}
function onLoadedAction (e:Event):void 
{
    this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onLoadingAction);
    gotoAndStop(currentFrame+1);
}
function ioErroAction (e:IOError):void 
{
    trace("Dev Ben " + e.toString());
}

This code is supporting for chrome and firefox. But if I run using IE, its stuck with onLoadingAction.

What do I needs to do to run in IE?

7
  • Just out of curiosity, do you get to output the traces of onLoadingAction?
    – goliatone
    Jul 13, 2011 at 9:01
  • @ goliatone: Read my question completely.
    – Benny
    Jul 13, 2011 at 10:09
  • I did read it. I just don't understand what you mean by stuck with onLoadingAction I had a similar issue in IE.
    – goliatone
    Jul 14, 2011 at 7:53
  • Stuck means... Its not moving to COMPLETE event handler, staying with progressEvent event handler.
    – Benny
    Jul 14, 2011 at 8:12
  • Check with Mike Welsh answer... thats working well.
    – Benny
    Jul 14, 2011 at 8:13

1 Answer 1

5

Unfortunately, the COMPLETE event of the root loaderInfo isn't reliable and behaves differently in different browsers. It will fail to fire in some browsers if the file is cached or running locally.

Instead, checked that loaderInfo.bytesLoaded == loaderInfo.bytesTotal in an ENTER_FRAME or TIMER handler:

addEventListener(Event.ENTER_FRAME, onEnterFrame);

function onEnterFrame(event:Event):void
{
    if(loaderInfo && loaderInfo.bytesLoaded == loaderInfo.bytesTotal)
    {
        // load complete
    }
}
3
  • could not the Progress event be used to make that check?
    – goliatone
    Jul 13, 2011 at 9:01
  • 1
    Unfortunately, I believe the ProgressEvent can have the same issues of not firing in certain environments. Just now when testing a local SWF in IE9, the PROGRESS event did not fire even though the COMPLETE event did. So, in general, I would not trust the events on the root loaderInfo, and would just check for the completion in an ENTER_FRAME.
    – Mike Welsh
    Jul 22, 2011 at 4:47
  • Just ran into this problem with Flash 11.8 on IE10. Progress events won't fire when opening the file on local harddrive (c:/index.html loading c:/movie.swf). Switching to onEnterFrame and checking for bytesLoaded worked flawlessly. Thanks! Aug 20, 2013 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.