this is my code:
function resizepic() {
container._alpha = 0;
totalw = container._width;
totalh = container._height;
maxw = 378;
maxh = 284;
if (totalw>totalh) {
factorw = (maxw/totalw);
container._width = maxw;
container._height = factorw*totalh;
container._x = _root.xpos+(((maxw)-container._width)/2);
container._y = _root.ypos+(((maxh)-container._height)/2);
}
if (totalh>totalb) {
factorh = (maxh/container._height);
container._height = maxh;
container._width = factorh*totalw;
container._x = _root.xpos+(((maxw)-container._width)/2);
container._y = _root.ypos+(((maxh)-container._height)/2);
}
container._alpha = 100;
}
but the problem is that when a pic is 400 * 398 you get this:
totalw>totalh (400>398)
factorw = 378/400 = 0.945
container._width = 378
container._height = 0.945*398 = 376.11
as you see the container._height is bigger than the maxh (maximum height) but the _width is just fine⦠how do i fix this problem??
thanks for helping