Skip to main content
Known Participant
July 12, 2011
Question

Column absoluteStart and textLength

  • July 12, 2011
  • 1 reply
  • 495 views

Any advice on the best way of retrieving the absoluteStart and the textLength on a column?

So if I have a controller that has two columns, I want to find the character that ends the first column and starts the second one.

Thanks,

Joel

This topic has been closed for replies.

1 reply

Participating Frequently
July 13, 2011

Hi, absoluteStart is text-offset of start of line - from beginning of the TextFlow

I have a method to do what you want, but not sure if it's the best way. We can discuss.

As below code shows, you can loop through the textFlowLines inside of the textFlow, then get the columnIndex property, if it's 1, means it's in the second column, then you can get the text info from the textLine.

var text:String = null;

var textFlowLine:TextFlowLine = null;

for(var i:int = 0; i < textFlow.flowComposer.numLines; i ++)

{

     textFlowLine = textFlow.flowComposer.getLineAt(i);

     if ( textFlowLine.columnIndex == 1 )

          break;

}

text = textFlowLine.getTextLine().textBlock.content.text;

text is the first text line of column two.

text length of the first column is textFlowLine.absoluteStart - 1