So, there’s this bug with Flash & Firefox where the stage width is set to 0 when the app is loaded and doesn’t get calculated until a bit later (the linked post says up to 8 frames, which isn’t long, but most of our hooks that do stuff when an app loads are executed before that).
So, I have this picture viewer that shows before/after images. The viewer can be used in fullscreen mode, and it dynamically positions the images differently depending on how much space it has to work with. That space is determined by the stageWidth and stageHeight.
To do this positioning, I listen to the resize event of the stage. For some reason, in Firefox, when the user goes into and out of fullscreen mode, it wasn’t correctly laying out the contents, and I’ve come to find that it’s because of a similar issue.
The workaround is to use a timer to slightly delay the execution of the positioning method in the callback to the resize event.
var positionImagesLater:Function = function(event:Event):void {
var timer:Timer = new Timer(200, 1);
timer.addEventListener(TimerEvent.TIMER, function():void {
positionImages(event);
});
timer.start();
};
addEventListener(Event.RESIZE, positionImagesLater);
Blogsplat