Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4321496
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:45:12+00:00 2026-05-21T08:45:12+00:00

I have some flex3 code that uses a TextArea to select a line from

  • 0

I have some flex3 code that uses a TextArea to select a line from a char index:

var tf:IUITextField=ta.mx_internal::getTextField();
var lineIndex:int= tf.getLineIndexOfChar(someCharIndex);
var lineCharIndex:int= tf.getLineOffset(lineIndex);
var lineLength:int= tf.getLineLength(lineIndex);
ta.setSelection(lineCharIndex, lineCharIndex+lineLength);

I’d like to upgrade this to flex4’s TextArea, but I’m not sure what the flex4 equivalents of the IUITextField methods are (getLineIndexOfChar, getLineOffset, getLineLength).

Can someone point me to some docs for these methods?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T08:45:12+00:00Added an answer on May 21, 2026 at 8:45 am

    Here is a simple application which illustrates how to select text line with Spark TextArea using TLF and its TextFlow:

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" 
        xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="init()">
        <fx:Script>
        <![CDATA[
            import flashx.textLayout.compose.TextFlowLine;
            import flashx.textLayout.elements.TextFlow;
            import flashx.textLayout.events.SelectionEvent;
    
            private function init():void
            {
                var textFlow:TextFlow = ta.textFlow;
                textFlow.addEventListener(SelectionEvent.SELECTION_CHANGE, textFlow_selectionChangeHandler);
            }
    
            private function textFlow_selectionChangeHandler(event:SelectionEvent):void
            {
                // Just getting char index
                var selectionStart:int = event.selectionState.absoluteStart;
                var textFlow:TextFlow = ta.textFlow;
                var line:TextFlowLine = textFlow.flowComposer.findLineAtPosition(selectionStart);
                ta.selectRange(line.absoluteStart, line.absoluteStart + line.textLength);
            }
        ]]>
        </fx:Script>
        <s:TextArea width="400" height="200" verticalCenter="0" horizontalCenter="0" id="ta">
            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor 
            incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco 
            laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate 
            velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, 
            sunt in culpa qui officia deserunt mollit anim id est laborum.      
        </s:TextArea>
    </s:Application>
    

    All that you need is located in textFlow_selectionChangeHandler() method. After determining char position we extracted TextFlowLine for this position and then selected it. To test this code just click somewhere in your TextArea.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code that uses an ArrayCollection, it imports: import mx.collections.ArrayCollection; then: static
I have some UI in VB 2005 that looks great in XP Style, but
I have some code for starting a thread on the .NET CF 2.0: ThreadStart
We have some input data that sometimes appears with &nbsp characters on the end.
I have implemented some utility classes in Flex that I want to use in
We have that Flex app talking to the server. We need some kind of
I have a windowed Flex application (AIR) that uses an HTML file for the
I have a piece of Actionscript code that Implements MovieClip. I don't seem to
I am have that problem, that I got some javascript that shows a flexibg
I have a Flex application that needs to grab reporting data from a JasperReports

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.