Actionscript 3.0, Adobe, Flash, Flex, Web developer

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

9 thoughts on “Code Snippets : Solving Flash loading problem with WMode and Firefox

  1. Thanks! Good to know. There’s another problem with the stage dimensions and FF3. Shortly after the SWF loads, the stage.stageWidth and stage.stageHeight are both equal zero. That could be a problem i.e. when centering the preloader. The fix is simple:

    private function checkStageDimensions():void
    			if (!stageRef.stageWidth || !stageRef.stageHeight)
    				if (stageCheckCount < 10) setTimeout(checkStageDimensions, 100);
    				stageCheckCount ++;	
    			} else {
  2. sherest says:

    thanks! i faced the same problem, but your this useful information helps me out.

    thanks a lot.


  3. Ran into a similar issue that Og2t mentioned. If my swfs (multiple embedded video players) weren’t immediately visible in Firefox, their stage was 0. Solution was to use the Event.ENTER_FRAME listener to check the values of stage.stageWidth and stage.stageHeight before I ran any resizing functions which depended on accurate stage values.

  4. DostavkaTovarov says:

    Доставка любых товаров, грузов и оборудования из Китая по всей России, таможенная очистка и сертификация. Объем от 10 куб.м. или вес от 2т. Многолетний опыт, оптимальные цены и сроки. 100% официально и надёжно! Ваш № телефона на почту или майл-агент dostavkatovarovСОБАКА, или на ICQ 271-272-525 и мы Вам позвоним!

  5. Hello, I figured this was a timing issue since FireFox seemed to be killing my events somehow… This is a good workaround and I recommend it to anyone having the same problem. Thank you very much for posting this.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s