1 Reply Latest reply on Oct 30, 2009 4:45 AM by Ned Murphy

    Vertically centering flash movie in browser with Stage.scaleMode



      I have this flash website where i use Stage.scaleMode to dynamically resize the swf depending on the browser size. (i use A.script 2.0). So the width takes the whole screen and the height is scaled in proportion. My design is in a landscape format.

      It works fine, except that i need the swf to also be vertically centered in the browser Window. (explanantion - on certain screens, example a 19 inch PC monitor which is quite "squared", my flash movie expands the whole way across the width, and the height in proportion, but as my design is in landscape, i have a big empty space in the browser below the swf.)


      This is how it is:wrong.jpg    This is how it should be: good.jpg




      Anyone can help please?

      Here is the code:



      Stage.scaleMode = "noScale"
      Stage.align = "TL";
      bg_ratio = bg_mc._width / bg_mc._height;
      function stageResize():Void {
       stage_ratio = Stage.width / Stage.height;
       if (stage_ratio >= bg_ratio) {
        bg_mc._width = Stage.width;
        bg_mc._height = bg_mc._width / bg_ratio;
       } else {
        bg_mc._width = Stage.width;
        bg_mc._height = bg_mc._width / bg_ratio;
      var stageListner:Object = new Object();
      stageListner.onResize = function():Void  {