Firefox 3 Mac Flash Bug stageWidth and stageHeight are 0
Yet another issue with Firefox 3 on the Mac and the Flash player. Flash cannot detect the stage.stageWidth and stage.stageHeight on fixed sized swfs in Firefox 3 on OSX. According to Flash, they are 0,0. You can imagine what this kind of problems this causes. Any code that relies on the width and height of the stage, such as layout and sizing, fail on Firefox 3 on OSX.
Here you can see it in action. Open this page in any browser other than Firefox 3 on OSX and Flash correctly shows the stage.stageWidth and stage.stageHeight.
http://www.stevensacks.net/flashbugs/stage/index.html
Here's the source.
Waiting until ADDED_TO_STAGE to fire doesn't help, as shown here:
http://www.stevensacks.net/flashbugs/stage/index2.html
Here's the source.
The reality of the situation is that in Firefox 3 on OSX, the stage.stageWidth and stage.stageHeight are not available for MULTIPLE frames, as shown here. If it loads cached, it's one frame. If you clear your cache, I've seen it take up to EIGHT FRAMES before stageWidth and stageHeight are not 0.
http://www.stevensacks.net/flashbugs/stage/index3.html
Here's the source.
So the question is who is responsible? Is it Firefox 3 or is the Flash player?
—
Update: Apparently, this is an issue on Win/IE, as well.
http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/
January 20th, 2009 at 5:38 pm
All three work fine for me. FF 3.0.5, FP 10 (debugger), OSX 10.5.6
January 20th, 2009 at 5:45 pm
I've seen this before too. Pretty crappy. As a workaround I think I just set an onEnterFrame listener or interval and cleared it once something other than zero came back.
January 20th, 2009 at 5:48 pm
Everyone in my office sees 0,0, even the people who have zero plug-ins.
January 20th, 2009 at 6:07 pm
Same config than Mike keesey and I can see stageWidth and Height in your exemple.
Try to set "noflash" as id parameter in your swfObject call, to have your flash object wrapped inside a div.
January 20th, 2009 at 6:37 pm
I've seen many SWFs across the web recently where all the content seems to be stuck in the top-left corner. It's probably related since I'm using FF3 on a Mac.
In the past, I've seen this issue on Windows machines, which you noted in the update. The best solution I found for that problem (it may not work here) is to always listen for Event.RESIZE if you need to do any sort of calculations using the stage size. Do your sizing once right away when the SWF is initialized, but also listen for the resize event, just in case stageWidth and stageHeight were zero.
January 20th, 2009 at 6:58 pm
This has been a problem with IE7 too. You can vote on the bug here:
http://bugs.adobe.com/jira/browse/FP-434
The more people who vote, hopefully the more likely we are to see this bug get fixed (if it's Adobe's problem).
January 21st, 2009 at 1:05 am
everything works fine for me too.
FF 3.0.5 on MAC 10.5
January 21st, 2009 at 1:23 pm
i'm seeing what you guys are here as well.
Fist two examples show 0,0.
The third seems fine.
Does it have anything to do with FP Version like debug player etc?
January 22nd, 2009 at 2:10 pm
I was seeing this exact behavior on my Firefox 3.0.5 build on my PC laptop. I am running several plug-ins, which included Adblock 0.5.3.043 as well as Adblock Plus 1.0.1. In my disabling/enabling of plug-ins, I found that Adblock 0.5.3.043 caused this behavior in a completely reproducible manner, regardless of whether I whitelisted the page and site or not. Easily reproducible with both the Weather Channel new local map and the stageWidth/stageHeight page Steven has created.
Disabling this plug-in and substituting Adblock Plus instead alleviates this problem completely. Just an FYI to those that might be seeing this behavior and using that FF plug-in…
January 23rd, 2009 at 1:48 pm
I've hit this issue on windows running Flash 9 in the past. I just took it as a flash quirk and coded around it using enterframe like you last sample.
not sure who to blame or if there is another fix.
-erik
January 26th, 2009 at 1:40 pm
works fine in FF3 for me too [ 10.5.5 ]
January 26th, 2009 at 5:06 pm
aral balkan had a similar issue that he attributes to swfobject (rather than FF or the flash player in isolation), which i note that you're using in your example pages.
http://aralbalkan.com/1933
January 26th, 2009 at 5:28 pm
Thanks for the heads up, Jed! And thanks to Aral for delving deeper than I did.
January 27th, 2009 at 5:45 am
I have added this issue to the SWFObject FAQ (Q21):
http://code.google.com/p/swfobject/wiki/faq
August 16th, 2009 at 9:44 am
Ughhh. This is why I hate Information Technology.
I was sizing my chromeless player based on Stage.width, unaware that zero was lurking in the chaos.
I added FlashVars to my AC_RunActiveContent duplicating width and height so I can always get my default stage size, regardless of bunk global variables.
I just spent weeks debugging a Flash quirk. Good luck in HTML5, oh mighty ubiquitous plug-in.
August 25th, 2009 at 3:47 pm
yeah this is a major pain. the problem occurs about 20% of the time in FF3 when trying to capture the stage dimensions after an ADDED_TO_STAGE event.
September 28th, 2009 at 8:51 am
Thanks for putting this out there. After reading this I've made a simple JS function which I can call from flash (if the stage.stageWidth comes back as 0) which gives me the divs width and height which seems to work great.
October 23rd, 2009 at 8:15 am
Thanks for posting this. I revisited an old site that was bugging out and I was going crazy thinking how I could have left such a bug.
Fortunately, my site isn't so dependent on the stage size changing. Has anyone tried referencing displayObject.parent.width ?