Skip to main content
February 7, 2011
Question

How to retrieve text from TextLines

  • February 7, 2011
  • 1 reply
  • 316 views

hi,

I'd like to compute the text which is displayed by n number of TextLines. I was trying to obtain the text displayed by a single TextLine through

composer.getLineAt(0).getTextLine().textBlock.content.text

but this displays much more than what this TextLine actually draws.

This topic has been closed for replies.

1 reply

February 7, 2011

got it

var str:String = "";         var flowComposer:IFlowComposer = textFlow.flowComposer;         var lineLimit:uint = Math.min(n, flowComposer.numLines);         var flowLine:TextFlowLine = flowComposer.getLineAt(lineLimit - 1);         var endIndex:uint = flowLine.absoluteStart + flowLine.textLength;         return textFlow.getText(0, endIndex);