Groups | Blog | Home
all groups > flash actionscript > november 2006 >

flash actionscript : loadmovie scale help


Andrew Thelwell
11/27/2006 11:47:50 AM
Hi,

You need to work out the final width yourself, since there is no
"maintain aspect ratio" ability in ActionScript...

once you've done loading...

//-----------------------------------------------------------------------
var targetWidth:Number = <your value>;
var origHeight:Number = pic_mc._height;
var origWidth:Number = pic_mc._width;
var scaleRatio:Number = targetWidth/origWidth;
var targetHeight:Number = origHeight * scaleRatio;

pic_mc._height = targetHeight;
//------------------------------------------------------------------------

....should do it.


[quoted text, click to view]
Ricky Bobby
11/27/2006 7:35:57 PM
i know how to load the picture using the loadmovie function. And I even know
how to scale the pic using either a percentage or a pixel value. However, what
I am stuck on something, and if I explain the situation it would help me
explain my problem. I am creating a 'yearbook' shall we say type of look for
one of my pages in flash. this yearbook will grab the pictures of the members
from an online folder instead of using set pics, due to the fact that I want it
interactive allowing the members to upload the latest pics and all that. My
specific question is how do i load each pic and just set the hieght in pixels,
so that the pics all appear at the same hieght, and then set the width pixels
to scale accordingly keeping the aspect ratio of the pic. Currently I only
know how to set the width pixels manually, but I need it to just move along
with the hieght pixel. Any help with this code would be great. And at the
same time if you could help me with a quick preloader script too for while the
pic is loadign that would help me out alot. Thanks
arunbe
11/28/2006 4:37:08 PM
AddThis Social Bookmark Button