So I've been staring at my screen all day, my client getting increasingly irate trying to work out what's going on.

I'm on Flash CS3, AS 2.0

Here's my code:


Actionscript Code:
//set stage for FBF
Stage.align = "TL";
Stage.scaleMode = "noScale";
loadMovie("image.jpg", pic, 'GET');

//define dynamic aspect ratios
picHeight = new Object ();
picHeight = pic._height / pic._width;

picWidth = new Object ();
picWidth = pic._width / pic._height;






//conditional statement to account for various initial browswer sizes and proportions

if ((Stage.height / Stage.width) < picHeight) {
    pic._width = Stage.width;
    pic._height = picHeight * pic._width;
} else {
    pic._height = Stage.height;
    pic._width = picWidth * pic._height;
}


//center picture on stage
pic._x = (Stage.width / 2) - (pic._width / 2);
pic._y = (Stage.height / 2) - (pic._height / 2);



// create listener
sizeListener = new Object();

// make listener change picture size and center picture on browser resize
sizeListener.onResize = function() {
   
    if ((Stage.height / Stage.width) < picHeight) {

        pic._width = Stage.width;
        pic._height = picHeight * pic._width;
    } else {
        pic._height = Stage.height;
        pic._width = picWidth * pic._height;
    }
   
   
pic._x = (Stage.width / 2) - (pic._width / 2);
pic._y = (Stage.height / 2) - (pic._height / 2);
   
}

//add listener to stage
Stage.addListener(sizeListener);

My problem is my client wants to be able to change image.jpg occasionally, to ones of different size ratios. If the "pic" movieclip has a box of the right size ratio inside it I have no problem unless I change the image, which I need to be able to do. If there is nothing inside the movieclip when I load it, the image always appears on its side, and I can't seem to get it rotate to the correct position!

Please help if you can - I'm desperate!