ActionScript Pagination Example

NOTE: Updated to TLF Build 460.

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 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.

13 Responses to ActionScript Pagination Example

  1. 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.

  2. 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 …

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

  4. Richard Dermer says:

    Recent TLF builds can be found in the latest build of Gumbo. See the SWCs in the Gumbo Repository.

  5. David Slatton says:

    There’s no update of the framework publicly available yet. Continue to monitor the Labs forum for news:

  6. Adam says:

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

    • Alan Stearns says:

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

      • Adam says:

        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. –
        Method marked override must override another method. –


        • Richard Dermer says:

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

          • Adam says:

            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?

  7. judah says:

    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.