Background image scalling proportionally

I'll make this easy and fast! :)

Step 1

Open our index.fla and let's write some code!

Put this code inside the setStage function:

//proportional
if ((Stage.height / Stage.width) < mc_bgHeight) {
mc_bg._width = Stage.width;
mc_bg._height = mc_bgHeight * mc_bg._width;
} else {
mc_bg._height = Stage.height;
mc_bg._width = mc_bgWidth * mc_bg._height;
};
//end proportional


Step 2

And now we'll go to the bottom at line 532 and inside that listener.onLoadInit = function(target_mc) { we'll paste this code:

//proportional
mc_bgHeight = new Object ();
mc_bgHeight = mc_bg._height / mc_bg._width;

mc_bgWidth = new Object ();
mc_bgWidth = mc_bg._width / mc_bg._height;

//condition
if ((Stage.height / Stage.width) < mc_bgHeight) {
mc_bg._width = Stage.width;
mc_bg._height = mc_bgHeight * mc_bg._width;
} else {
mc_bg._height = Stage.height;
mc_bg._width = mc_bgWidth * mc_bg._height;
};

//centering
mc_bg._x = (Stage.width - mc_bg._width) / 2;
mc_bg._y = (Stage.height - mc_bg._height) / 2;
//end proportional



That's all! :)