get text from TextLine
How do I actually get the text that is rendered in a TextLine object?
I just can't find it, though im quite sure I overlooked something. ![]()
How do I actually get the text that is rendered in a TextLine object?
I just can't find it, though im quite sure I overlooked something. ![]()
If the TextLine was created by TLF, then its userData property should be a TextFlowLine. The TextFlowLine has an absoluteStart, which tells you where in the TextFlow it starts, and a textLength. The TextFlowLine also has a paragraph. From the paragraph you can get the TextFlow, and the TextFlow has a getText() method for getting the text.
So, putting this all together, something like this should work:
var textFlowLine:TextFlowLine = textLine.userData as TextFlowLine;
var textFlow:TextFlow = textFlowLine.paragraph.getTextFlow();
var textOfLine:String = textFlow.getText(textFlowLine.absoluteStart, textFlowLine.absoluteStart + textFlowLine.textLength);
- robin
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.