Stage Resize Refresh IE 6 Bug Fix


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /*
  2. Use if your objects position is based on stage.stageWidth and stage.stageHeight.
  3. When refreshed it traces 0 for stageWidth and stageHeight
  4. */
  5. function startApp():void {
  6. // make it call an function on resize
  7. stage.addEventListener(Event.RESIZE, resizeHandler);
  8. // call that resizeHandler again (for browsers like IE 6)
  9. resizeHandler();
  10. }
  11.  
  12. function resizeHandler(e:Event = null):void {
  13. // check if the Height and Width is bigger than zero and act accordingly.
  14. if ( stage.stageHeight > 0 && stage.stageWidth > 0 ) {
  15. // safe area. Do normal resize
  16. }
  17. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.