I just ran into a weird SWFObject error on Firefox 3 on OS X. Basically, the app was not getting
The Weird SWFObject sizing issue in Firefox article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.
stage.stageWidth and stage.stageHeight set correctly when it loaded (it was getting 0 for both).
Redraw issue on FireFox for MacOs X. - Google Code">a related issue on the SWFObject issue tracker and the workaround suggested by Bobby there (to force a refresh on the loadEvent) works but causes an unsightly refresh on the movie.
The workaround I implemented was to pass in the actual width and height of movie via FlashVars. The movie uses these instead of stage.stageWidth and stage.stageHeight.
Finally, to clarify, this issue does not occur on Safari or when using the embed code generated by the Flash IDE.
The Weird SWFObject sizing issue in Firefox article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.
Aral, this happens only for dynamic publishing, true?
Why not use a resize handler? When the stage size is initially 0 the Flash Player itself usually keeps on triggering the stage.resize event until it receives its current value.
Look like very close to symptoms of an issue i had ages ago with ie6 and the old SWFObject.
Basically solved by using a resize handler to get to a point where stageHieght and stageWidth could be relied upon.
Code snippet in the comments here: http://blog.creacog.co.uk/2007/12/02/strange-stage-size-problem-but-only-in-ie6/
Sounds like the same issue Steven Sacks blogged about last week:
http://www.stevensacks.net/2009/01/20/firefox-3-mac-flash-bug-stagewidth-and-stageheight-are-0/
I guess the best workaround is to have a resize handler on the stage and deal with it whenever the reported dimensions change (whether this is because the stage was resized or because the flash player finally figured out what size it was meant to be)…
I have added this issue to the SWFObject FAQ (Q21):
http://code.google.com/p/swfobject/wiki/faq
[...] Weird SWFObject sizing issue in Firefox (from aralbalkan.com) [...]
I had a similar problem with this in IE6 on XP and what I do now for all my flash movies is delay them for 50ms before I process any code. I cant find where I found this solution at but this seems to solve the issue. Let me know if it works…
/* Timer used to delay loading of Flash move by milliseconds to fix bugs related to IE */
var _ieDelayTimer:Timer = new Timer(50, 1);
_ieDelayTimer.addEventListener(TimerEvent.TIMER, onIETimer);
_ieDelayTimer.start(); // Timers in AS3 must be explicitly started
/* Delays the movie from loading by 50 milliseconds to allow everything to initialize and protect against known bugs in IE
*/
function onIETimer(e:TimerEvent):void {
_ieDelayTimer.removeEventListener(TimerEvent.TIMER, onIETimer);
init(); // put the start of all my code initialization, setting params, listeners, stagewidth vars etc in this function
}
You can also do whatever you have to do with stage.stageWidth and stage.stageHeight after the first cycle of an enterframe. By then the stage width and height are properly set.
private function init():void
{
addEventListener( Event.ENTER_FRAME , delay );
}
private function delay( e:Event=null ):void
{
removeEventListener( Event.ENTER_FRAME , delay );
var w:Number = stage.stageWidth;
var h:Number = stage.stageHeight;
}
thanks. super
[...] > Aral Balkan – Weird SWFObject sizing issue in Firefox [...]
Thanks for sharing~