Archive for June, 2009

Code Snippets : Solving Flash loading problem with WMode and Firefox

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();
  }
}


Info

Blog of Aleksandar Gvozden Technical director of MADEBYPLAY

Welcome and enjoy... more updates coming soon!

Catch me on
Twitter
LinkedIn
Facebook


CU3ER - 3D Image Slider

Twitter

Tags


Follow

Get every new post delivered to your Inbox.