Wednesday, December 31, 2008

vector image view in flex

When we expand the image/increase the resolution of the image, the image will get scattered/distrubance in image pixel. To avoid this we need to set the Bitmap smoothing to true.

In flex default the bitmap smoothing will be set to false, so we need to enable to true.

After doing lot of R & D, I found the solution from the link

http://weblogs.macromedia.com/mc/archives/2006/09/enable_smoothin.html

Below is my code which helps in smoothing the image when I zoom on my page.

---------------------------------------------------
public function smoothTheImage(e:Event):void{
var mySmoothImage:Bitmap=new Bitmap;
var obj:Object=new Object();
obj=e.target;
mySmoothImage=e.target.content;
mySmoothImage.smoothing = true;
invalidateSize();
invalidateDisplayList();
}
-------------------------------------------------

We need to set Smoothing of the Bitmap to true. It will have some performance issue which need to fix.

No comments:

Post a Comment