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.

flip pages

I have been given with the task of creating a book reader which will flip the pages using flex.

I have used http://www.quietlyscheming.com/blog/components/flexbook/ the opensource.

Here we can filp the pages. So I have taken the source from here and started to integrate and modify/alter the code accroding to my need.

In the End I got the required result with lot of R & D.

You can flip the book pages by clicking at the top and bottom edge of the page, zoom at top of the pages by clicking in top body of the page and for bottom you can click on bottom of the page.

While zooming the page, I have faced smoothing image, so I have applied Smoothing property for the bitmap image which gives me good smoothing.

You can look at my below link to view one of my sample book.
Click here to view flexflippage sample from Freado.com site