Skip to main content
Inspiring
February 18, 2010
Answered

TextFlow.textLength vs TextFlow.getText().length

  • February 18, 2010
  • 1 reply
  • 1206 views

I have an empty textFlow.

trace(textflow.textLength);            // 1

trace(textflow.getText().length);     // 0

Exported in TextConverter.TEXT_LAYOUT_FORMAT:

<TextFlow color="#000000" fontFamily="_sans" fontSize="12" paddingLeft="4" paddingRight="4" paddingTop="3" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008"><p><span></span></p></TextFlow>

Why would textLength be 1 and not 0?

This topic has been closed for replies.
Correct answer rdermer

All paragraphs have a terminator and a length of one.  That allows the editing code to use an index to indicate a selection location when there are consecutive empty paragraphs.

TextFlow.getText takes a paragraph separator as a parameter that defaults to \n - its between the paragraphs and the final paragraph doesn't get one.

Richard

1 reply

rdermerCorrect answer
Adobe Employee
February 18, 2010

All paragraphs have a terminator and a length of one.  That allows the editing code to use an index to indicate a selection location when there are consecutive empty paragraphs.

TextFlow.getText takes a paragraph separator as a parameter that defaults to \n - its between the paragraphs and the final paragraph doesn't get one.

Richard

josh_onAuthor
Inspiring
February 18, 2010

Thanks