Skip to main content
Inspiring
Feb 18, 2010 9:09 PM UTC
Answered

TextFlow.textLength vs TextFlow.getText().length

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 is closed to new replies. Start a new post to keep the conversation going.
rdermerCorrect answer
Inspiring
Feb 18, 2010 9:27 PM UTC

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

2 replies

rdermerCorrect answer
Inspiring
Feb 18, 2010 9:27 PM UTC

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

Translate
josh_onAuthor
Inspiring
Feb 18, 2010 9:43 PM UTC

Thanks

Translate