1
votes

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?

1
Just out of curiosity, do you get to output the traces of onLoadingAction?goliatone
@ goliatone: Read my question completely.Benny
I did read it. I just don't understand what you mean by stuck with onLoadingAction I had a similar issue in IE.goliatone
Stuck means... Its not moving to COMPLETE event handler, staying with progressEvent event handler.Benny
Check with Mike Welsh answer... thats working well.Benny

1 Answers

5
votes

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
    }
}