Cyberspace Nova

Code Snippets : Solving Flash loading problem with WMode and Firefox

June 5, 2009 · 7 Comments

I’ve recently experienced problems on few AS3 websites. If you embed your SWF file with different WMode, like opaque or transparent in Firefox your Flash won’t load. Actually the Flash loads first frame and then it seems like it stops. Well, it certainly loads but the problem is that loaderInfo Event.COMPLETE and PROGRESS are not fired in Firefox.

That is LAME! Firefox has this “advanced” feature with Flash, it doesn’t load it until that browser tab has focus. Seems like we’re getting problem from there. Anyway, a workaround is to set the Event.ENTER_FRAME function that will check loader

addEventListener(Event.ENTER_FRAME, _listenLoading);// on enter frame to check if it’s loaded
private function _listenLoading(e:Event):void {
  if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal) {
    removeEventListener(Event.ENTER_FRAME, _listenLoading);
    _onSiteLoaded();
  }
}

Categories: Actionscript 3.0 · Adobe · Flash · Flex · Web developer

7 responses so far ↓

Leave a Comment