fullscreen scale image proportionally
I'm really close to make a "fullscreen scale image proportionally". Now i know how scale image proporcionally to width, or height. I don't know how i can combine this two scales. For explane first script is for scale width:
Code:
sky.height = (stage_width / old_width)*old_height;
sky.scaleX = stage_width / old_width;
And this is for scale height:
Code:
sky.width = (stage_height / old_height)*old_width;
sky.scaleY = stage_height / old_height;
I wonna do something like this:
Code:
function() {
if (stage_width > stage_height) {
sky.height = (stage_width / old_width)*old_height;
sky.scaleX = stage_width / old_width;
}
else if (stage_width < stage_height) {
sky.width = (stage_height / old_height)*old_width;
sky.scaleY = stage_height / old_height;
}
}
Idea is really simple. If my web broswer have more width like height, then flash web site use first script. Else use secund script. But i'm not a programmer, so i don't know how i can make this :/
Plz help me