Hey,
I know how to make an image full screen, also with a onresize listener. But! Because some of the images are only of a certain pixel size, I don’t want to stretch them above that.
So, do any of you know how to set limitations?
The code I am using is:
tree_mcHeight = new Object ();
tree_mcHeight = tree_mc._height / tree_mc._width;
tree_mcWidth = new Object ();
tree_mcWidth = tree_mc._width / tree_mc._height;
if ((Stage.height / Stage.width) < tree_mcHeight) {
tree_mc._width = Stage.width;
tree_mc._height = tree_mcHeight * tree_mc._width;
} else {
tree_mc._height = Stage.height;
tree_mc._width = tree_mcWidth * tree_mc._height;
};
tree_mc._x = Stage.width / 2;
tree_mc._y = Stage.height / 2;
sizeListener = new Object();
// make listener change picture size and center picture on browser resize
sizeListener.onResize = function() {
if ((Stage.height / Stage.width) < tree_mcHeight) {
tree_mc._width = Stage.width;
tree_mc._height = tree_mcHeight * tree_mc._width;
} else {
tree_mc._height = Stage.height;
tree_mc._width = tree_mcWidth * tree_mc._height;
};
tree_mc._x = Stage.width / 2;
tree_mc._y = Stage.height / 2;
}
//add listener to stage
Stage.addListener(sizeListener);
It would be nice to change the background colour surrounding the image when it resizes as much as possible.
If needed, I can post an fla…
Thanks in advance,
Chris.