Groups | Blog | Home
all groups > flash actionscript > april 2007 >

flash actionscript : How to retrieve the selected text from textField in Flash MX using actionscript



dotnetuser
4/27/2007 9:18:47 PM
I need to be able to get the text selected by user after clicking a dynamic
scrolling textfield.
I am very disappointed to find no method that returns the selected text when
there is a property of textField to make it selectable.

I am using Flash MX. Let me know if this is possible in newer versions if not
in MX.

Thanks
Dhanashri
GWD
4/27/2007 9:43:00 PM
Well, I don't think the Selection class has changed since MX. up until version
8...

Can't you use the getCaretIndex or getBeginIndex & getEndIndex methods of the
Selection class? If you've got the indices and you know the contents of your
textfield, then you have all you need to know to get the selection range of
actual text.

Not sure how practical it is trying to do that in a scrolling text field
though. Wouldn't it be difficult to select text that way if its scrolling?
dotnetuser
4/27/2007 11:29:49 PM
Thanks.
it worked.
I am displaying text in a scrolling textfield and the text contains some words (like hotwords in glossary) which can be clicked by the user.

AddThis Social Bookmark Button