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.
Posted by: Joshua Mostafa | January 6, 2009 3:06 PM
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 ...
Posted by: Joshua Mostafa | January 26, 2009 7:32 PM
Specifically, I'm getting a TypeError (really an NPE) thrown at ContainerControllerBase.posToRectangle()
Posted by: Joshua Mostafa | January 26, 2009 7:37 PM
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/
Posted by: Richard Dermer | January 28, 2009 11:20 AM
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
Posted by: David Slatton | January 29, 2009 1:29 PM