Sunday, December 7, 2008

Flip pages in Flex - developer configuration

I was googling aroung the net to find the solution to have flip pages using some reader designed using Flash. Finally I got the soultion, Open Source code which helped me in finding the answer for my problem. The book reader is coded using Flex.

The speed of the flip is good and easy to understand, intergated the open source reader with our appliction.
You can use the below link to download the open source.
http://www.quietlyscheming.com/blog/components/flexbook/
You can download the opens source from the above link, then unzip the file.

Open the new project in flex sdk, then configure with work space.

Once you have configured, you will find few mxml pages such as fullpage,Datadriven, anotonmy etc...

I have used Datadriven in which the image URL is passed inside the tag.

So if you want to configure for your images, you need to replace the URL inside the tag but its static.

If you want to do it dynamically, you need to create one function which you need to call in flex book component aat "initalize".

Inside the function add the flex book component id with content property and set the URLs dynamically.

eg: public function loadcontent():void
{
book.content[0]="http://www.yahoo.com/images/1.png";
book.content[1]="http://gmail.com/images/2.png";
/*
for (var i:int =0;i<5;i++)
book.content[i]="http://freado.com/book"+i.tostring()+".png";
*/
}

Here book is the id of the flex component.

If you have any query, you can mail Am happy to help you