[thelist] Flash: Scaling a loaded image to Xpx and Ypx?

Benjer futureweb at macmail.com
Tue Oct 15 03:41:01 CDT 2002


Frank,

Firstly your gonna have to make sure the image has loaded before you try to
resize it.

Then swap _xscale for _width and _yscale for _height.

Good luck.
Ben

On 15/10/02 4:22 am, "Frank" <framar at interlog.com> wrote:

>
> I'm still in the painful newbie stage of learning Flash MX
> Action Script. I've learned how to dynamically load a jpg
> into a movie. The images that will be uploaded will very
> rarely be of the exact same dimensions, so scaling percent
> wise doesn't exactly do what I want. I would like to scale
> an image up and down to a precise amount of pixels (say,
> 150px high by 250px wide)
>
> Here is my current code, can someone offer an alternative?
>
> ---
> function displayImg(img, imgMC, imgHeight, imgWidth) {
>       img = loadMovie(img, imgMC);
>       img._yscale = imgHeight;
>       img._xscale = imgWidth;
> }
> img = "http://localhost/Test/249-2.jpg";
> imgMC = "myImage";
> displayImg(img, imgMC, 125, 200);
> ---
>
> Thanks.
>
> --
> Frank Marion
> Tel. 416 825 7488
> framar at interlog.com
> http://www.frankmarion.com







More information about the thelist mailing list