Pagination example

In the latest pagination example, found here, http://sourceforge.net/projects/tlf.adobe/files/2.0/current/samples.zip/download, the pages 2 and on do not continue where the previous pages left off. They seem to skip a paragraph or more between pages.

Hi thx1138, I debugged in it and found there is a bug in the sample code, please comment out line 128 in Pagination.as. The key down event was called twice sometime, this caused page missing.
//_pageView.processKeyDownEvent(e);

Similar Messages

  • Flex pagination example help

    I've found a flex paging example I'd like to get working, but can't seem to get it running.
    The Example files can be found here: http://blogs.adobe.com/tlf/2008/12/actionscript-pagination-exampl.html
    I've downloaded and imported the project into flex. However I seem to  have an error that prevents the example from running. Here is the error  that appears
    unable to open '/Users/Adam/Documents/Flex Builder 3/libs'
    This is what displays if I try to run the project anyways:
    File not found: file:/Users/Adam/Documents/Flex%20Builder%203/Pagination/bin-debug/PaginationAS.swf
    Does anyone have any idea how I can go about getting this example up and running in flex?

    take a look at this post with an advanced DataGrid Pagination Example.
    http://forums.adobe.com/message/3166670#3166670

  • Span removing spaces in Pagination example

    any idea why the pagination example removes spaces when span is applied? for example, this code (straight from the example),
    renders like this,

    This was a bug in the example, sorry. The "ignoreWhitespace" flag in the XML object is set true by default, and for parsing text-related XML it should be set false. If you change that, the spaces should be handled correctly.
    - robin

  • Pagination example 1 ... | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17

    Hello there. As I have sought out a reasonable solution for paging nagivation and compared designs such as Google's search result paging to designs such as this forum's paging navigation, I have decided to go with this forum's design which I found somewhat better and more of a challenge. I did however, step it up a notch and attempt to improve it by acheiving a constant page group return size (with the exception of undersized page group lists and end groups that don't span the default page group size). This is one behaviour I noticed this forum's paging lacking. You can notice it when you are first starting your paging through the forum, the number of pages listed varies each time you page forward/backward until you reach a stable point deeper into the pages.
    This paging utility, however, maintains a constant page group list size which may be preferred when looking to fit the navigator into a constrained area.
    Anyhow, the following is a complete working example:
    package web.util;
    import java.util.ArrayList;
    import java.util.List;
    * @author javious
    public class Pagination {
        /** Creates a new instance of Pagination */
        public Pagination() {
         * @param totalItems is the total of all items to be paged.
         * @param currentPage is a page from the returning list to be currently displayed.
         * @param defaultCursorPosition (zero based) is the usual position within the
         *        returning list in which
         *        we want to display the current page. Should the current page be less than
         *        this position, then this parameter gets overridden with the page's position.
         *        Should the current page be greater than the final(of the last page group)
         *        page position minus the preferred page position, then this
         *        parameter gets overridden with the page's position.
         * @return List of page numbers in relation to the supplied parameters.
        public static List<Integer> getList(int totalItems,
                                            int currentPage,
                                            int resultPageSize,
                                            int pageGroupSize,
                                            int defaultCursorPosition)
            List<Integer> pageList = new ArrayList<Integer>();
            // first obtain the first item index of the absolute last page of
            // all known records.
            int finalPageItemStartIndex = (totalItems - totalItems % resultPageSize);
            if(totalItems % resultPageSize == 0)
                finalPageItemStartIndex-=resultPageSize;
            // Now obtain the final page index
            int finalPage = 0;
            if(finalPageItemStartIndex > 0)
                finalPage = 1+(int)Math.ceil((double)finalPageItemStartIndex/resultPageSize);
            int offset = pageGroupSize;
            if(currentPage > defaultCursorPosition)
                offset -= defaultCursorPosition;
            else
                offset -= (int)Math.min(pageGroupSize, currentPage);
            int endPage = Math.min(finalPage, currentPage + offset);
            int startPage = 0;
            if(currentPage > defaultCursorPosition && finalPage >= endPage)
                startPage = Math.max(1,endPage - pageGroupSize + 1);
                pageList.add(0);
            for(int i=startPage;i<endPage;i++)
                pageList.add(i);
            return pageList;
    }and the initial servlet
    package web;
    import java.io.*;
    import java.net.*;
    import java.util.ArrayList;
    import java.util.List;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import web.util.Pagination;
    * @author javious
    * @version
    public class PaginationTest extends HttpServlet {
        private static final int testItems[][] = {new int[210],
                                            new int[133],
                                            new int[7], // good test for within boundaries
                                            new int[111],
                                            new int[10], // good test of matching group size.
                                            new int[20] // good test of divisible
        static {
            for(int i=0;i<testItems.length;i++)
                for(int j=0;j<testItems.length;j++){
    testItems[i][j] = (int)Math.ceil(Math.random()*10000);
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    int resultPageSize = 10;
    int pageGroupSize = 10;
    int defaultPageCursorPosition = 3;
    response.setContentType("text/html;charset=UTF-8");
    // add parent total so jsp can list links for them.
    request.setAttribute("parentTotal", testItems.length);
    String sParentIndx = request.getParameter("parentId");
    String sCurrentPage = request.getParameter("itemPg");
    int parentIndex = (sParentIndx != null ? Integer.parseInt(sParentIndx) : 0);
    int currentPage = (sCurrentPage != null ? Integer.parseInt(sCurrentPage) : 0);
    request.setAttribute("parentId", parentIndex);
    request.setAttribute("itemPg", currentPage);
    int targetItems[] = testItems[parentIndex];
    int totalItems = targetItems.length;
    int startIndex = currentPage*resultPageSize;
    request.setAttribute("pageStart", startIndex+1);
    int maxResultIndex = Math.min(totalItems, startIndex + resultPageSize);
    List pageItems = new ArrayList();
    for(int i=currentPage*resultPageSize;i<maxResultIndex;i++)
    pageItems.add(targetItems[i]);
    request.setAttribute("pageItems", pageItems);
    // add totalPages so jsp can determine whether or not
    // to show "previous" link
    int totalPages = totalItems/resultPageSize; // 2 pages = 0 to 1
    if(totalItems % resultPageSize > 0)
    totalPages++;
    request.setAttribute("totalPages", totalPages);
    // add this so jsp can tell when to add "..."
    request.setAttribute("defaultPageCursorPosition", defaultPageCursorPosition);
    List pageList = Pagination.getList(totalItems, currentPage,
    resultPageSize, pageGroupSize, defaultPageCursorPosition);
    request.setAttribute("pageList", pageList);
    request.getRequestDispatcher("pagination_test.jsp").forward(request,response);
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    public String getServletInfo() {
    return "Short description";
    and now for the nagivator portion of your JSP/JSTL
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
        you must also add the JSTL library to the project. The Add Library... action
        on Libraries node in Projects view can be used to add the JSTL 1.1 library.
        --%>
        <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
           "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    <STYLE type="text/css">
    .pagingLink {text-decoration: none}
    </STYLE>
    </head>
    <body>
    <h1>Parent Lists</h1>
    <c:forEach begin="0" end="${parentTotal-1}" var="indx" varStatus="loopStat">
    <c:choose>
    <c:when test="${parentId == indx}">
    <b>${loopStat.count}</b>
    </c:when>
    <c:otherwise>
    <a href="PaginationTest?parentId=${indx}">${loopStat.count}</a>
    </c:otherwise>
    </c:choose>
    </c:forEach>
    <h1>Items</h1>
    <ol start="${pageStart}">
    <c:forEach var="item" items="${pageItems}" varStatus="loopStat">
    <li>${item}
    </c:forEach>
    </ol>
    <table border="0" cellpadding="2" cellspacing="1">
    <tr>
    <c:if test="${itemPg-1 >= 0}">
    <td><a class="pagingLink" href="PaginationTest?parentId=${parentId}&itemPg=${itemPg-1}"><<</a>
    </td>
    </c:if>
    <%-- Loop through paging numbers list --%>
    <c:forEach var="pg" items="${pageList}" varStatus="loopStat">
    <c:if test="${!(loopStat.index eq 0 and loopStat.last)}">
    <td>
    <c:if test="${loopStat.count > 1}">
    |
    </c:if>
    <c:choose>
    <c:when test="${itemPg == pg}">
    <b>${pg+1}</b>
    </c:when>
    <c:otherwise>
    <a class="pagingLink" href="PaginationTest?parentId=${parentId}&itemPg=${pg}">${pg+1}</a>
    <c:if test="${loopStat.count == 1 && itemPg > defaultPageCursorPosition}">...</c:if>
    </c:otherwise>
    </c:choose>
    </td>
    </c:if>
    </c:forEach>
    <c:if test="${itemPg+1 < totalPages}">
    <td><a class="pagingLink" href="PaginationTest?parentId=${parentId}&itemPg=${itemPg+1}">>></a>
    </td>
    </c:if>
    </tr>
    </table>
    </body>
    </html>

    hi
    I m giving a code for pagination. this is for displaying 5 records per page i think it may help ful to you
    <html>
    <body>
    <link href="Stylesheet/style.css" rel="stylesheet" type="text/css">
    <script language="javascript" src="TableSort.js">
    </script>
    <br>
    <br>
    <center><H2> Student Details </H2></center>
    <%
                   int loop_var=Integer.parseInt(request.getParameter("i"));
                   Vector vecResults=new Vector();
    // store the records in vector
                   vecResults=dataAccessLayer.readObjects("QueryToAllStudents");
                   String strSortable="sortable";
                   int rec=vecResults.size();
                   int i=0,roll_number;
                   HashMap hmRecord;
                   if (rec==0)
                        roll_number=1;
                   else
                        hmRecord = (HashMap)vecResults.elementAt(rec-1);
                        roll_number=Integer.parseInt((String )hmRecord.get("std_rno"))+1;
                   session.setAttribute("roll_number",roll_number+"");
                   if (rec==0)
                        out.println("There are no records in database please enter");
    %>
                        <br>
                        Add &nbsp
    <%
                   else
    %>
                             <table border="1" width="70%" align="center" id="studentdetails" class=<%=strSortable%>>
                                       <tr>
                                       <th bgcolor="PINK" sort="true" align=center>Roll No</th>
                                       <th bgcolor="PINK" sort="true" align=center>Name </th>
                                       <th bgcolor="PINK" sort="true" align=center>Date Of Birth </th>
                                       <th bgcolor="PINK" sort="true" align=center>Subject1 </th>
                                       <th bgcolor="PINK" sort="true" align=center>Subject2 </th>
                                       <th bgcolor="PINK" sort="true" align=center>Subject3 </th>
                                       <th bgcolor="PINK" sort="true" align=center>Total </th>
                                       <th bgcolor="PINK" sort="true" align=center>Modby </th>
                                       </tr>
    <%
                             String s;
                             while (i<5 && loop_var<rec)
                                       hmRecord = (HashMap)vecResults.elementAt(loop_var);
                                       s=((String )hmRecord.get("std_dob")).substring(1,10);
    %>
                                       <tr>
                                       <td><center><%=hmRecord.get("std_rno")%></center></td>
                                       <td><center><%=hmRecord.get("std_name")%></center></td>
                                       <td><center><%=s%></center></td>
                                       <td><center><%=hmRecord.get("std_sub1")%></center></td>
                                       <td><center><%=hmRecord.get("std_sub2")%></center></td>
                                       <td><center><%=hmRecord.get("std_sub3")%></center></td>
                                       <td><center><%=hmRecord.get("std_tot")%></center></td>
                                       <td><center><%=hmRecord.get("std_modby")%></center></td>
                                       </tr>
    <%
                                       loop_var++;
                                       i++;
    %>
                             </table>
                             <center>
                             <br>
                             <br>
    <%
                             if (loop_var>=11)
    %>
                                  <a href="List.jsp?i=<%=(((loop_var/5)*5)-5)%>">Prev &nbsp|</a>
    <%                    }
                             else
    %>
                                  <a href="List.jsp?i=<%=0%>">Prev &nbsp|</a>
    <%                    }
                             int j=1;
                             for (i=0;i<rec/5;i++,j++)
    %>
                                       <a href="List.jsp?i=<%=(i*5)%>"><%=j%>&nbsp|</a>
    <%
                             if (rec%5!=0)
    %>
                                       <a href="List.jsp?i=<%=(i*5)%>"><%=j%></a>
    <%
                             if (loop_var<rec)
    %>
                                  <a href="List.jsp?i=<%=loop_var%>">| &nbsp Next</a>
    <%                    }
                             else
                             if (rec%5==0)
    %>
                                  <a href="List.jsp?i=<%=(loop_var-5)%>">| &nbsp Next</a>
    <%                    }
                             else
    %>
                                  <a href="List.jsp?i=<%=(loop_var-rec%5)%>">| &nbsp Next</a>
    <%
    %>
                             </center>
                             <br>
                             <br>
                             Add &nbsp
                             Edit / Delete &nbsp
                             List
    <%
    %>
         </body>
         </html>

  • A MVC datatable with dropdown filtering per column search with pagination example?

    Hello All,
    Just starting out a big project with MVC 3 and I've been searching for a while for any step by step example of creatintg a dynamic/ajax datatable that has real time filtering of the result set via dropdowns for mvc?  Is there a ready made solution already
    available for the MVC framework?
    Thanks,

    Hello,
    Thank you for your post.
    Glad to see this issue has been resolved and thank you for sharing your solutions & experience here. It will be very beneficial for other community members who have similar questions.
    Your issue is out of support range of VS General Question forum which mainly discusses
    WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    If you have issues about ASP.NET MVC app in the future, I suggest that you can consult your issue on ASP.NET forum:
    http://forums.asp.net/
     for better solution and support.
    Best regards,
    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Pagination  using Struts and jsp

    Hi ,
    I am newer to this forum. I want pagination example using struts. plz help me

    [_Pagination + Struts_|http://www.google.com/search?hl=en&q=pagination+struts&meta=]

  • Multiple ContainerControllers  with RichEditableText

    Hi, I wonder if someone could help with regard to the following issue.
    Starting with a heavily modified version of the initial tlf actionscript Pagination example. I import a text flow of varying length, create seperate containercontrollers and containers ,compose and  place the resulting pages in an array for display, using a page fwd /backwards principle.
    When I use a RichText container paging fwd or back works fine, and I get all the text displayed, but if I use a RichEditableText (required in the app for  insertion of links) the paging works fine but all I get displayed is  the first line of each page. I have tried to set various properties like, selectable and editable to false but to no avail.
    What am i missing.
    Regards
    John
    Ok i am still having major problems with getting my head around this, and whist trying to find a solution,I have found two or three posts suggesting that RichEditableText containers do not support linking. Can someone say definively whether or not this is the case. If it is the case can someone suggest a way of doing the following. Here is my scenario
    Various different text flows will be created and formatted from imported xml dynamically, the resulting textflow will be of varying length, and in some instances so long that just using one container would mean scrolling forever. Hence i need someway of "paging" , which I have succesfully achieved using a RichText Container, ie compose to several different containers, and add and remove them from the display list.
    The above would be fine apart from the fact that I need to be able insert hyperlinks into the textflow, and the only container able to support this is the ret. Any detailed sugestions would be much appreicated, as I am still a relative newbie with flex and as3 .

    Neither RichText nor RichEditableText support multiple ContainerControllers so what you are doing is neither supported nor tested.  The fact that it works in RichText is coincidental.  IMHO you'd be better off creating your own paginating widget.
    Richard

  • TLF BUG ?

    I've tried to implement my own paging system based on pagination example, but I ran into strange results. I assume is not a performance issue, but I want to make sure.
    The problem is that textFlow isn't flowing corectly in containers, 'sometimes' jumps a container like in the picture below.
    Paginator File.txt - http://jump.fm/JANVC
    Main.txt - http://jump.fm/WMDRH
    Thanks

    Sorry for the delay.
    Yes.  There are known bugs in updating with multiple containers in TLF 1.1.
    It was covered at least somewhat in this thread:
    http://forums.adobe.com/message/2786010#2786010
    There is a proposed workaround but it may not have completely solved the problem.
    Richard

  • SelectionManager blinking i-beam removal

    I have an application that for all intents and purposes can
    be considered similar to the Pagination example.
    I do not want the end user to be able to edit the document
    however I need to do certain operations when the end user interacts
    with the text, such as perform some actionscript when they click a
    LinkElement, or create a hover box over certain ParagraphElements
    and DivElements on mouseover.
    Therefore I have created a superclass to SelectionManager to
    handle the text events and the mouse events.
    The side effect of this design is that when the end user
    hovers the mouse over any old text, the mouse pointer is almost
    always an i-beam insertion point, giving the impression that
    editing is available, even though they cannot in fact edit.
    If I find an alternate way of doing the events and eliminate
    the SelectionManager altogether, then I dont get the handy ability
    for my users to select a section of text and copy it to the
    clipboard.
    Surely there must be a way, when using a SelectionManager to
    have the cursor be the arrow when hovering over arbitrary text and
    a hand pointer when hovering over a LinkElement rather than the
    i-beam, however, I cannot figure out how to make this happen on my
    own.
    If anybody out there can help me with this, I will surely owe
    you my gratitude.
    Thanks,
    Tim
    Anyone?

    longlostbigelow ,
    Thans for your reply.
    I must have done that 100 times, but just couldnt get it to
    work..... then you inspired me to try one more time, with one
    slight change...
    In my mouseOverHandler, I was doing some processing, and in
    general, if nothing special was happening i would return
    super.mouseOverHandler(e).
    Well, that was what was doing me wrong....
    super was overriding the mouse cursor.
    Thanks for taking the time to peek at this. You really made
    my app much prettier with one simple change.
    Thanks,
    Tim

  • Getting error in Compose call

    In the latest Gumbo release 5022, using TLF, I am getting the
    following error after I call compose...
    Error: Error #2175: One or more elements of the content of
    the TextBlock has a null ElementFormat.
    at flash.text.engine::TextBlock/DoCreateTextLine()
    at flash.text.engine::TextBlock/createTextLine()
    at flashx.textLayout.compose::ComposeState/createTextLine()
    at flashx.textLayout.compose::ComposeState/composeNextLine()
    at
    flashx.textLayout.compose::BaseCompose/composeParagraphElement()
    at
    flashx.textLayout.compose::BaseCompose/composeBlockElement()
    at
    flashx.textLayout.compose::BaseCompose/composeBlockElement()
    at
    flashx.textLayout.compose::BaseCompose/composeBlockElement()
    at
    flashx.textLayout.compose::BaseCompose/composeBlockElement()
    at flashx.textLayout.compose::BaseCompose/composeInternal()
    at flashx.textLayout.compose::ComposeState/composeInternal()
    at flashx.textLayout.compose::BaseCompose/composeTextFlow()
    at flashx.textLayout.compose::ComposeState/composeTextFlow()
    at flashx.textLayout.compose::StandardFlowComposer/
    http://ns.adobe.com/textLayout/internal/2008::callTheComposer()
    at
    flashx.textLayout.compose::StandardFlowComposer/internalCompose()
    at flashx.textLayout.compose::StandardFlowComposer/compose()
    When I look at the container, prior to the call, it has a
    content length of 0, so maybe this is a proper error. Still, I am
    switching over from the previous TLF format API
    (Container/Paragraph/Character to TextLayoutFormat), and I get this
    error where I never did previously.
    From a code standpoint, I am essentially uising the
    recomputeContainers function from the Pagination Example that has
    been on your blog for a while, it loops to create 10 containers at
    a time, then compose call is made, and this process happens until
    the full content has been composed. This loop works a few times,
    but then around the 4th time (I have 30 pages and 40 controllers),
    I get the error on the call to compose.
    My migration was not very creative, I simply found everywhere
    that I was using the previous format APIs and changed them to the
    TextLayoutFormat. Additionally, I am doing a significant
    TextFilter.import call from markup of which I did not make any
    changes to for the migration (do i need to?) at all.
    Is there something in the migration step that I am missing,
    or is there a specific reason why Compose generates this exception
    now versus previous releases of Vellum/
    Thanks for you attention to this,
    Tim

    I have some markup that causes the error in the Pagination
    example when used as the import text instead of the Alice in
    Wonderland text.
    The behaviour is bizarre, because if you use the content
    markup (the div with id='D20070324' and its children) once or
    twice, it usually composes, however, if you put the content in the
    markup 3 or 4 times(as in the example below), it fails.
    The behavior seems related to the ending Div that is empty.
    If I change it to:
    <div
    id='commentsdiv8944'><p><span></span></p></div>
    Then everything renders.
    Is having some content in a Div a new requirement or is this
    a bug?
    Thanks,
    Tim

  • Linked Containers- ability to avoid orphaned text lines

    Once again visiting the Pagination example.... Is there any
    elegant way to avoid having orphaned lines from spilling over to
    the next container. I would love to be able to indicate that a
    paragraph should always have at least two lines in a single
    container, or some other solution that is similar... maybe an
    attribute on a paragraph or span that indicates,
    "keepLinesTogehter".
    I realize that I could do some sort of calculation on the
    number of textlines after a container is updated, and then
    essentially modify the paragraphs to have line breaks to force an
    adjustment, but this seems like a real hack.
    Any info is greatly appreaciated, and a solution would simply
    make my day.
    Thanks,
    Tim
    Anything?

    I'm afraid that for now you are left with the real hack. I
    think this would be a good feature, but its not trivial, especially
    in an environment that supports editing.

  • Best way to handle multi-page documents?

    Hi,
    I'm creating a multi-page editor on top of TLF and I'd like to hear some opinions about the best way to handle multi-pade documents.
    I'm basicaly considering two options:
    1.) A single RichEditableText and several ContainerControllers.
    2.) Several RichEditableText.
    Tks.

    I'm not sure you can create a RichEditableText and give it multiple ContainerControllers. If you use multiple RichEditableText
    components, then you will have to decide in advance which text goes in which one.
    We have posted sample code for doing this in straight ActionScript, which you could presumably also host inside a Flex container. See:
    http://blogs.adobe.com/tlf/examples/
    Look for "ActionScript Pagination Example".
    - robin

  • How can I extract the native SQL generated by TopLink?

    How can I extract the native SQL generated by TopLink?
    This is useful for example to use pagination, or pass the SQL to a stored procedure that may do many things, like using a cursor, or apply security.
    Pagination example where the SQL inside the inner parentheses are generated from Toplink, and the outer SQL is generic:
    select *
    from
    (select xx.*, rownum as rn
    from
    (select o.order_id, r.name, ...
    from placed_order o, restaurant r
    where o.restaurant_id = r.restaurant_id
    order by o.order_ext_id
    ) xx
    where rownum < 21)
    where rn > 10

    Alternatively, you can open your sessions.xml in the Mapping Workbench and for a specific session, you can Click the Login Tab and then the Options tab. Then select "Native SQL" and it will be outputted to the console (assuming that is where you outputing it).
    zb

  • TLF and Flex Mobile

    Has anyone tried using TLF code in a Flex 4.5 Mobile application? Everything compiles and runs fine but the text is invisible. Any known workarounds for this?

    I was trying to run a simple pagination example that works fine as a web app.
    It uses the paginationWidget.as and Alice.as files which can be found here: http://blogs.adobe.com/tlf/files/2010/09/Pagination20Build169.zip
    Any help would be appreciated.
    Thanks
    The code for the Home view is:
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark" title="Home">
    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
    <![CDATA[
    import tools.PaginationWidget;
    import flashx.textLayout.conversion.TextConverter;
    import flashx.textLayout.elements.TextFlow;
    import flashx.textLayout.formats.TextAlign;
    import flashx.textLayout.formats.TextLayoutFormat;
    public var pageView:PaginationWidget = new PaginationWidget();
    public var curChapter:int = -1;
    private function init():void {
    storyBox.width=this.width;
    storyBox.addChild(pageView);
    pageView.setSize(storyBox.width, storyBox.height);
    setChapter(0);
    private function setChapter(chapterNumber:int):void
    curChapter = chapterNumber;
    var textFlow:TextFlow = TextConverter.importToFlow(Alice.contents[chapterNumber], TextConverter.TEXT_LAYOUT_FORMAT);
    pageView.textFlow = textFlow;
    private function prevChapter():void
    if (curChapter > 0)
    setChapter(curChapter-1);
    private function nextChapter():void
    if (curChapter >= 0 && curChapter < Alice.contents.length-1)
    setChapter(curChapter+1);
    ]]>
    </fx:Script>
    <s:Group top="0" left="0" right="0">
    <s:Button left="100" top="0" width="70" height="25" label="np"
      click="pageView.nextPage()" fontSize="18"/>
    <s:Button left="0" top="0" width="70" height="25" label="pp"
      click="pageView.prevPage()" fontSize="18"/>
    <s:Button right="0" top="0" width="70" height="25" label="nc" click="nextChapter()" fontSize="18"/>
    <s:Button right="100" top="0" width="70" height="25" label="pc" click="prevChapter()" fontSize="18"/>
    <s:SpriteVisualElement id="storyBox" top="25" bottom="0" left="0" right="0" />
    </s:Group>
    </s:View>

  • Accessing raw text of TextFlow and performing a search

    I am trying to figure out the best way to perform a search
    within a TextFlow to locate a specific piece of text (either a word
    or set of words).
    I have had a hard time figuring out how to actually gain
    access to the raw text of the TextFlow that is loaded. Once that is
    loaded, I need to be able to search through that text, find the
    location of the text, and show that container.
    Essentially add search capability to the Pagination example.
    The only thing I can think of that seems like it may work
    would be to export the TextFlow into an XML file, then perform the
    search on the XML file. Once that is done, I would have to figure
    out which position in the xml file the text was located, and load
    the container with that position....
    Surely there is a better way?
    Thanks, Tim

    I think so - here's how I'd reccomend approaching the
    problem.
    Given a TextFlow I'd do a getFirstLeaf. That returns a
    FlowLeafElement. I'd then look at the FlowLeafElement.text property
    to access the text for matching. To advance to the next leaf
    element use FlowLeafElement.getNextLeaf.
    You'll have to do some book keeping when you find a match to
    figure out the absolute position of the beginning of the match.
    Next step would be to use
    textFlow.flowComposer.findControllerIndexAtPosition to figure out
    which container has the matched text.
    Adding niceties you could search a paragraph at a time by
    taking advantage of the limitElement parameter to getNextLeaf.
    After calling getFirstLeaf call getParagraph to find the paragrah
    and use that as the limit element. To advance to the next paragraph
    use null as the limit element and call getParagraph again for the
    new limit element.
    Hope that helps.
    Richard

Maybe you are looking for

  • Update from windows 8.1 pro evaluation copy to windows 8.1

    Greetings. Today i suddenly got BSOD when i play some games. It was too fast i cant see what the error is. And after my pc restart thers an error messege it says my windows evaluation copy has expired and will restart every 2 hour and it told me to d

  • Help required in compiling Java Code.

    I have java1.6 installed on my PC but I want to compile my code in such a way that it will run on PCs with lower versions of java installed. I am not using any feature specific to java1.6 in my program. I am using Netbeans IDE 6.1 Thanks in advance.

  • Clicking on download doesn't open usual dialog window on some websites

    Firefox 26 in Xubuntu 13.10. When I download files (.pdf, .rar, .txt, or whatever) from most sites a dialog window opens asking me what I want to do with said file, e.g. open with Default utiliy for that file type, or save file to local disk. This do

  • How do I get rid of expired rental movies that won't go away

    I have three rental movies, one from September, that have viewed and/or the rental period expired. The movies say expired on the iTouch and won't play. They won't go away and their are consuming disk space. The don't show up in iTunes. How can I get

  • How can I stop App Store pop-ups every time I use my iPhone?

    It seems like every time I turn on my iPhone 4S lately, there is a window asking me if I would like to go to the App Store.  I have to click "OK" or "Cancel" before I can use the iPhone.  Extremely annoying.