Fullscreen Image (Keep Proportions)

Out of context: Reply #8

  • Started
  • Last post
  • 14 Responses
  • ********
    0

    you take the ratio of the image (width/height) and compare it to the ratio of the users browser size (width/height), if it is wider, you use the height of the browser for the height of the image, and the width is the height * the ratio of the image.

    If it is narrower then you use the width of the browser for the image, and the height is the width / the ratio of the image.

    You'll need to offset these obviously, set your alignment to TL and a listener something along the lines of...

    Stage.align = "TL";
    Stage.scaleMode = "noscale";
    Stage.addListener(this);

    function onResize() {
    //PUT YOUR CODE IN HERE to check for stage.width etc.
    }

View thread