Extended Textfield to get pixel coordinates of characters

Converting x,y position in a text field into index and vice versa is very useful. Flash Coders with Director background already know the advantage. With this we can create text rollovers, place emoticons and pictures in line with the Textfield.
I came to know about it through one of the FlashCoders email, Eric Westra has created a component which extends the Textfield to have the following additional methods.

countRows();
findVisibleIndex();
addRowHeight();
positionToIndex();
positionToIndexRow();
indexToPosition();
findNextRow();
getWidth();

I haven’t tried it yet. Try it your self by downloading TextFieldExtension.mxp.

Leave a Reply