Does anyone out there have an example code that can
can scale a group of images with different sizes into one fixed size?
In other words, I have an array of images coming into my movie. that have different sizes. I place each image upon a Mc that resides inside another movie clip and resize accordling. The problem is, all of the images have to be the same size. I want to be able to import any size image and scale and resize it to a specific size.
I’m already using the _height and _width properties on my Mc.
I believe I have to use the _scalex and _scaley properies so I can import any size images. Don’t know how though.
Syko this is what I have so far…and it works but not the way I want it too. Maybe I’m not getting it.
One of the members wrote a function that sizes an image onto a movieclip and it works great. But only if the images are the same size. I want to be able to import any size image and scale if necessary and resize the image into my movieclip.
_global.resizeImage= function()
{
//maximum image dimensions
//Note: The images have to be the same size
//so they can be scaled the same.
wMax = 292; //42
hMax = 359; //109
if(img_mc._width > wMax || img_mc._height > hMax)
{
//which dimension is the most oversized
wDiff = img_mc._width - wMax;
hDiff = img_mc._height - hMax;
//calculate ratio
if(wDiff > hDiff)
{
ratio = (wMax/img_mc._width) * 100;
}
else
{
ratio = (hMax/img_mc._height) * 100;
}
}
else
{
//if image doesn't need to be resized set ratio to 100
ratio = 100;
}
img_mc._xscale = img_mc._yscale = ratio;