« Video for MAX 2008 TLF session available | Main | TLF API Changes in Build 370 »

ActionScript Pagination Example

NOTE: Updated to TLF Build 460. http://blogs.adobe.com/tlf/Pagination460.zip

The Pagination example in the TextLayoutFramework is posted to build with Adobe Flash CS4 Professional and the TextLayout plugin. Its also possible to build this example with Flex as an ActionScript only project. It does require the Flex 3.2 or Flex gumbo SDK.

I've posted the actionscript version that builds with Flexbuilder here: Download file

This version doesn't have the buttons the Flash Pro version has. Use page up/page down to switch between chapters and the arrow keys to move between pages.

Both the ActionScript version and the Flash Pro version use PaginationWidget.as to manage the paginated view. This is example code that you can use to build your own paginated view. The pagination widget adds new containers until all the text is in a container and then displays some number of containers emulating columns. It supports resizing the visible area. One of the goals was to avoid recomposing every time the visible area changed by a small amount. Hence the decision to relayout during resize has some heuristics.

Note that the labs release has bugs (since fixed) in displaying selections when some of the containers are not visible. This example doesn't make use of an interactionManager due to those bugs.

Comments

Nice one. I like the use of absoluteStart + textLength (line 140 of PaginationWidget) ... I had been iterating over all containers in flowComposer and summing each textLength to achieve the same result - your way is much cleaner.

Is the version of the framework that has fixed those bugs available anywhere? There is some odd behaviour in the app I'm working on that might be caused by a bug in the framework ...

Specifically, I'm getting a TypeError (really an NPE) thrown at ContainerControllerBase.posToRectangle()

Recent TLF builds can be found in the latest build of Gumbo. See the SWCs in the Gumbo Repository.
http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/frameworks/libs/

There's no update of the framework publicly available yet. Continue to monitor the Labs forum for news: http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=72&catid=669&entercat=y

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)