Fullscreen Image (Keep Proportions)

Out of context: Reply #3

  • Started
  • Last post
  • 14 Responses
  • sisu0

    // ***Stage aligned top left
    Stage.align = "TL";
    // *** Stop the stage from scaling with the browser window.
    Stage.scaleMode = "noScale";
    stop ();
    // initiate postitions and scaling values for objects
    if ( randomMovie._width > randomMovie._height ) {
    ratio = randomMovie._height / randomMovie._width;
    randomMovie._width = Stage.width;
    randomMovie._height = randomMovie._width * ratio;
    } else {
    ratio = randomMovie._width / randomMovie._height;
    randomMovie._height = Stage.height;
    randomMovie._width = randomMovie._height * ratio;
    }
    asab_logo._x = (Stage.width / 2) - (asab_logo._width / 2); // set the X and Y location for the progress bar. You may want
    asab_logo._y = 70; // to set this differently depending on your stage layout
    // end initial position setting

    //create a listener that checks to see if the browser window is resized
    sizeListener = new Object();
    sizeListener.onResize = function() {
    // change movieclip properties when the window is resized.
    if ( randomMovie._width > randomMovie._height ) {
    ratio = randomMovie._height / randomMovie._width;
    randomMovie._width = Stage.width;
    randomMovie._height = randomMovie._width * ratio;
    } else {
    ratio = randomMovie._width / randomMovie._height;
    randomMovie._height = Stage.height;
    randomMovie._width = randomMovie._height * ratio;
    }
    asab_logo._x = (Stage.width / 2) - (asab_logo._width / 2); // set the X and Y location for the progress bar. You may want
    asab_logo._y = 70; // to set this differently depending on your stage layout
    };
    Stage.addListener(sizeListener);

    // ***Loads random external swf
    loadMovie("random/0"+(random(5... _root.randomMovie);

View thread