# Proportional scaling mc in liquid layout

**URL:** <https://forum.kirupa.com/t/proportional-scaling-mc-in-liquid-layout/320057>\
**Category:** Uncategorized\
**Created:** [March 12, 2011, 8:57pm UTC](https://forum.kirupa.com/t/proportional-scaling-mc-in-liquid-layout/320057 "2011-03-12T20:57:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![media\_mixx](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@media\_mixx](https://forum.kirupa.com/u/media_mixx)\
**Post date:** [March 12, 2011, 8:57pm UTC](https://forum.kirupa.com/t/proportional-scaling-mc-in-liquid-layout/320057/1 "2011-03-12T20:57:20Z")

</div>

Hello,

I am using the following code to fill the browser window with an image and scale it up or down…works great. I would like to proportionately scale a mc but not have it initially fill the screen. It would start centered in the window at a initial size but then scale up as the browser window opens but not scale back down below it’s original starting size.

Can anyone offer insight into what I would have to modify in this code?

Any help would be greatly appreciated.

Thank you

this is the code for the full screen:

port1Height = new Object ();  
port1Height = port1.\_height / port1.\_width;

port1Width = new Object ();  
port1Width = port1.\_width / port1.\_height;

if ((Stage.height / Stage.width) \< port1Height) {  
port1.\_width = Stage.width;  
port1.\_height = port1Height \* port1.\_width;  
} else {  
port1.\_height = Stage.height;  
port1.\_width = port1Width \* port1.\_height;  
};

port1.\_x = Stage.width / 2;  
port1.\_y = Stage.height / 2;

bigmask.\_x = Stage.width / 2;  
bigmask.\_y = Stage.height / 2;

sizeListener = new Object();

sizeListener.onResize = function() {

if ((Stage.height / Stage.width) \< port1Height) {

port1.\_width = Stage.width;  
port1.\_height = port1Height \* port1.\_width;  
} else {  
port1.\_height = Stage.height;  
port1.\_width = port1Width \* port1.\_height;  
};

port1.\_x = Stage.width / 2;  
port1.\_y = Stage.height / 2;

}

Stage.addListener(sizeListener);
