5 Replies Latest reply on Jun 29, 2007 12:22 PM by kglad

# Mathematic question

Hi,
I have a slide show with an emptyMovieClip as a pic holder (Frame).
The images are loaded with a movie clip loader, so I know the original size of target_mc onLoadInit.

The pic holder has the size of
width 382 and height 246.

Now, each image should be loaded into my Frame, centred, but scaled, so they keep their original Format.
All images have different sizes, for ex. 850x450 or 240x900 and so on.

I want each image loaded into the frame, but scaled, so they fill the frame as much as possible.
For ex. the width of an image with 799x355 should be reduced to 382 and the height should be scaled accordingly, while an image with height of 815 and width of 250 will fill full the height of the frame of 246, but the width must be scaled correctly.

More difficult, as I thought in first place.
• ###### 1. Re: Mathematic question
It's a ratio so...

MaxHeight/MaxWidth = Height/Width ....

Assuming you were to force one of them to the max width or height everytime...

_mw / _mh = _xw / _oh - For the 850x450 image....
382 / 246 = _xw / 450 or ..... _xw = (382 / 246) / 450

In terms of variables....

_xw = ( _mw / _mh ) / _oh;
picHolder._width = _xw;
picHolder._height = _mh;

• ###### 3. Re: Mathematic question
stageW = 382
stageH = 246
my image A is 850x450
//*****
myW = (382/246)/450
gives me myW = 0.00345< so if I multiply with 100000 gives me myW 345.
would be ok, but a image for ex 799x335 jumps out of my frame.?