TextArea uses TextField to render the text characters.  If you look at the
livedocs (
http://livedocs.adobe.com/flex/201/langref/flash/text/TextField.html),
you'll see a lot of useful methods and properties.  There are probably a
couple ways to do this.  I would iterate through the lines of text using
getLineMetrics() and check to see if the line was inside the bounding box of
the TextField.  The character before that line should be the last character
shown.  Note that I'm not sure if you're going to care about the position of
the top of each line, or the bottom of each line.  You'll have to test
things like that for yourself.  To get to the textField of a TextArea you
can either subclass the TextArea or use textArea.mx_internal::getTextField().
(for more information on mx_internal see
http://nondocs.blogspot.com/2007/04/mxcoremxinternal.html)

- Dan Freiman

On 10/2/07, Jason The Saj <[EMAIL PROTECTED]> wrote:
>
>   I am dealing with a rather annoying dilemma.
>
> Often I'll set text or htmlText of a textArea dynamically. I will also
> turn off scrolling.
>
> Often as the case may be, the set text is longer than the displayable
> area. I'd like to be able to get the "displayed text length" (ie:
> last character position displayed). This is extremely hard to
> calculate due to the large variety of factors (ie: font size, word
> spacing, word wrap, etc).
>
> This must exist internally because Flash already recognizes whether a
> word extends beyond the bounds of the textArea and instead of simply
> cutting it off at the edge; it removes the entire word from display.
>
> Anyone aware of any way to get the last displayed character?
>
>  
>

Reply via email to