Skip to main content
Participant
April 14, 2009
Question

Spell Checker

  • April 14, 2009
  • 1 reply
  • 1325 views

I am re-writing our spell checker that we used with the RichTextArea in Flex 3 to work with TLF. I have implemented a solution based on the spell checker adornment example. I am now trying to optimise it to only update the visible text lines or only the recently updated text lines as updating the entire text flow is slow once there is a fair amount of text, and is unnecessary. I cannot find a way to find out if a text line is visible on screen or if it has been recently changed. Any help would be appreciated.

Thank you.

This topic has been closed for replies.

1 reply

May 4, 2009

you can always track changes to paragraph. Just need to monitor where the selection is and wether any operation occurs at that place. you will need to have a list of paras to do comparison then.

regards,

Minh Tran

Adobe Employee
May 6, 2009

The TextFlow sends out a DamageEvent whenever a range of text requires to be redrawn. You could add an event listener to the TextFlow for the DamageEvent, and keep track of which text is damaged. Then right when the text is about to be displayed you could spell check the damaged areas. This will be just the text that has changed. You will get DamageEvents for attribute changes as well as text changes, but this should limit the amount of rechecking you have to do.

Adobe Employee
May 6, 2009

One further thought -- the previous poster who suggested looking for FLOW_OPERATION_BEGIN, that will work better in the case where the text is being resized. Resizing the text will cause a damage to the entire flow. By contrast, if you check for FLOW_OPERATION_BEGIN and monitor the operations, that will work perfectly as long as the Flex component is not setting the content directly.

If you want to tell which text is currently in view, keep in mind that the TextFlow may contain lines which do not have parents. In that case, you know for sure that they are not currently in view. Alternatively, you could iterate through the TextLines that are on the display list.