Stage resizing

i have picture(s) for my background which are 1024x768 in size;

and i am loading the picture into a movieClip with new Loader();

the movieClip is initially located at 0,0 because the stage size is equal to the picture size.


now i am trying to set a stage resize function to work like this:

if the stage is scaled for example to 1680x1050 i want that the picture scales to: stage.stageWidth, but i also want for it to always remain proportional.

so the size of the movieClip which holds my Loader would in this case have to be: 1680x1260 for a picture to remain proportional;

so, i would always say: (fullContainer_mc is the name of the movieClip)

fullContainer_mc.width = stage.stageWidth; 
fullContainer_mc.height = ?;

so the first question is how to calculate this second number?

and what i also want, is if the picture is wider or higher than the screen (after resizing), to center it like its shown on the picture:

i think i can do it this way:

fullContainer_mc.y = (stage.stageHeight / 2) - (fullContainer_mc.height / 2);
fullContainer_mc.x = (stage.stageWidth / 2) - (fullContainer_mc.width / 2);


i have found some code which looks like it does something similar, but i still havent figured out how to calculate fullContainer_mc.height = ? to begin with :*(

                 var targetRatio:Number = stage.stageWidth / stage.stageHeight;    // stage ratio
   var destinationRatio:Number = fullContainer_mc.width / fullContainer_mc.height;    // movieClip ratio

    if (targetRatio > destinationRatio) {
        fullContainer_mc.height = stage.stageHeight;
        fullContainer_mc.scaleX = fullContainer_mc.scaleY;
    } else {
        fullContainer_mc.width = stage.stageWidth;
        fullContainer_mc.scaleY = fullContainer_mc.scaleX;
    }
    
    fullContainer_mc.x = (stage.stageWidth / 2) - (fullContainer_mc.width / 2);
    fullContainer_mc.y = (stage.stageHeight / 2) - (fullContainer_mc.height / 2);