5 Replies Latest reply on Jun 29, 2013 10:57 AM by kglad

    maintaining the ratio

    Ron Colmen Level 2

      I want to be able to scale my website to fit the browser. Below is my code - but doesn't it work when viewing in a browser. How can I make the webpage scale in a browser?

       

      var photoAspectRatio = border._width/border._height;

       

      sizeListener = new Object();

      sizeListener.onResize = function(){

          var stageWidth:Number = Math.round(Stage.width);

          var stageHeight:Number = Math.round(Stage.height);

       

           var stageAspectRatio = Stage.width/Stage.height;

          if (stageAspectRatio > photoAspectRatio ) {

               border._width = Stage.width;

               border._height = border._width/photoAspectRatio;

          } else {

               border._height = Stage.height;

               border._width = border._height*photoAspectRatio;

          }  

      }