You can put the Image in a container and set clipContent = true then
when you set the scaleX/Y of the image it will crop.

 

No matter what though you need to have a high enough resolution in your
image in order to zoom without pixilation.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of pankajtandon2003
Sent: Tuesday, July 08, 2008 8:25 AM
To: [email protected]
Subject: [flexcoders] Need to build a "true" zoom on an image

 

Hello,
I'm trying to do the following:
Load an image and zoom into one area (rectangle within that image)
automatically when the user clicks a button.
Initially I thought I would achieve this by using
bitmapData.copyPixels(...) by specifying a smaller and smaller
rectangle with each FRAME_ENTERed event.
So if I have an image that is 1024x1000 pixels and I display it in a
viewport of 800x600 pixels say. Then I use copyPixels and copy pixels
from a little way in (starting at 5, 5 say) and specifying the
rectangle width to be 790, 590 and forcing this (smaller) rectangle to
occupy the same space as the earlier bigger rectangle.

But then I realized that since I'm copying pixels, the image will get
pixelated. (Haven't tried it yet, but I'm guessing based on the
Javadoc of the copyPixels method).

So how can I get a zoom effect, so that it looks like I'm zooming into
a part of an image *without* having the image pixelate.

Note that if I use scaleX, scaleY, it will not "crop" the image which
is necessary to get the impression of zooming in. Changing scaleX and
scaleY will only make the *whole* image smaller/bigger. I want a true
zoom effect, where the outer edges of the image fall away.

A code snippet will really help!

Thanks in advance,
Pankaj

 

Reply via email to