by Richard Dermer

 Comments (13)

Created

December 23, 2008

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

  • By Joshua Mostafa - 3:06 PM on January 6, 2009   Reply

    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.

  • By Joshua Mostafa - 7:32 PM on January 26, 2009   Reply

    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 …

  • By Joshua Mostafa - 7:37 PM on January 26, 2009   Reply

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

  • By Richard Dermer - 11:20 AM on January 28, 2009   Reply

    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/

  • By David Slatton - 1:29 PM on January 29, 2009   Reply

    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

  • By Adam - 5:45 PM on September 27, 2010   Reply

    Can anyone help me to get this example running in flex. I’m getting an error – unable to open ‘/Documents/Flex Builder 3/libs’

    • By Alan Stearns - 5:55 PM on September 27, 2010   Reply

      Do you have a version of Flex Builder installed? You may need to change this path to wherever you have Flex Builder.

      • By Adam - 7:14 PM on September 27, 2010   Reply

        I created an empty libs folder in the projects directory – seems the download didn’t come with one. It also doesn’t come with a the .swf so I download it from the flash example and added it as well to the project directory.

        The only problem is I’m still getting for the project:

        The definition of base class DisplayObjectContainerController was not found. – PaginationWidget.as
        Method marked override must override another method. – PaginationWidget.as

        Thoughts?

        • By Richard Dermer - 8:18 PM on September 27, 2010   Reply

          Updated Pagination sample posted here. This is from the 2.0 depot but no changes have been made to this code since 1.0

          http://blogs.adobe.com/tlf/files/2010/09/Pagination20Build169.zip

          • By Adam - 8:38 PM on September 27, 2010  

            thanks Richard for your help… but I’m not having any luck. replaced the files with these new ones and now my project is riddled with errors.

            Why don’t they have complete working version of these examples that can just be downloaded and imported?

            Does anyone have any idea what I might be doing wrong? Anyone have a flex project of this example working that I could just import and run?

  • By judah - 11:20 AM on July 14, 2011   Reply

    Is there an updated example available for 4.5.1? The example I have runs but when I navigate to the next page there are paragraphs of text that are skipped.

    • By Richard Dermer - 4:33 PM on July 14, 2011   Reply

      Updated examples for TLF 2.0 are here: http://sourceforge.net/projects/tlf.adobe/files/2.0/
      Other versions may be found elsewhere in the TLF sourceforge site.

    • By Jin Huang - 6:31 AM on July 18, 2011   Reply

      please comment out line 128 in Pagination.as. The key down event was called twice sometime, this caused page missing.

      //_pageView.processKeyDownEvent(e);

ADD A COMMENT