Gustavo
Gustavo

Reputation: 1683

How to get caretIndex from a TextArea as TextField

I saw a lot of examples of using .caretIndex to get the index of cursor inside a TextField text, but I'm using TextArea and there is no such property, only selection index. So how do I get the cursor index position from a TextArea?

Edit: ok, I did a test and selectionBeginIndex is returning a value. Is it "right" to use it, or is there some specific way?

Upvotes: 1

Views: 576

Answers (1)

null.point3r
null.point3r

Reputation: 1103

you can use selectionBeginIndex

According to Adobe's documentation:

If there is no selection, this value is set to the position of the caret.

Upvotes: 1

Related Questions