0 Replies Latest reply on Jan 27, 2011 11:48 AM by danielmacias13

    FlowElement scroll position

    danielmacias13 Level 1

      Hi all,

       

      I have a RichEditableText inside a Scroller.  I want to find a certain string within the RichEditableText and scroll down to it using scroller.verticalScrollPosition.  I have no problem traversing through elements and finding the string, but once I find appropriate FlowElement I can't find a property that will get me its Y position so I can scroll to it.  TLF is pretty vast, so can someone help me out with this; it's driving me crazy!

       

      Here's the function that finds the string.  Once found, I don't know how to scroll...

       

      private function onListChange(event:IndexChangeEvent):void{

           var selectedItem:TableOfContentsItem = tableOfContents.selectedItem;

           var currentParagraph:ParagraphElement = contentText.textFlow.getChildAt(0) as ParagraphElement;

       

           do{

                if (currentParagraph.getText() == selectedItem.name){   //selectedItem.name is the search string

                     contentText.verticalScrollPosition = currentParagraph;  //currentParagraph property!?!?

                     break;

                }

           }while (currentParagraph = currentParagraph.getNextParagraph());

      }

       

      Thanks.