Tuesday, April 21, 2009

AS3 New TextField methods

There are a number of new methods on text fields that allow you to work with text in more interactive manner, including methods to convert character indexes to pixel positions, find lengths of lines and paragraphs, get line metrics (ascent, descent, leading, etc), and more.

//px position of chars & vice versa:
myTF.getCharBoundaries(index)
myTF.getCharIndexAtPoint(x,y)

//and a TON more:
myTF.getParagraphLength(index)
myTF.getLineIndexOfChar(index)

No comments: