Skip to main content
Participant
May 17, 2010
Question

synchronizing textflows

  • May 17, 2010
  • 1 reply
  • 341 views

I have a long document with a single textflow with a Div for each page.

I assign one Div at a time to a TextArea for editing.

I am doing a classical Find/Text sequence, first within a Div,

then beyond the Div in the larger textflow.

If I edit within a Div and the length of the Div text is changed,

I don't know how to apply the Div changes to the long textflow

so the next Find position is correct - it's off by the number of

characters equal to the length of the edited page length.

Here's a puzzling bit of code:

            var l2:int = rtEditor.textFlow.flowComposer.damageAbsoluteStart;
            rtEditor.textFlow.flowComposer.updateAllControllers();
            l2 = rtEditor.textFlow.flowComposer.damageAbsoluteStart;

Under the circumstances described, l2 is correct. When updateAllControllers executes, it's still non-zero afterwards.

This topic has been closed for replies.

1 reply

Adobe Employee
May 18, 2010

When the entire flow is composed, damageAbsoluteStart will be equal to the length of the TextFlow. If the entire TextFlow needs to be composed, damageAbsoluteStart will be 0. After the TextFlow has just been composed (updateAllControllers was called), damageAbsoluteStart may be less than the entire TextFlow if there was text at the end that did not need to be composed. This can happen in a scrollable container if you are not scrolled all the way to the end. Or it can happen in a linked container if you either have text that does not fit in the last container, or the container that you composed (updated) was not the last container.

If you edit within an area and wish to keep the position up to date, you could possibly do this the same way we do it with the selection. If the changes you are trying to track happen through the EditManager, you could override notifyInsertOrDelete to update your find position.

Hope this helps,

- robin