Skip to main content
Participant
May 22, 2010
Question

bound controls and tlf

  • May 22, 2010
  • 1 reply
  • 420 views

I've seen it mentioned (and confirmed it) that there are two ways to bind

a textarea control - the text property and the textFlow property. What are

the advantages and disadvantages of each?

I have a long TextFlow (a document) that is built up from pages. It

duplicates the structure of an existing printed book. Each page is

a file. I constuct the TextFlow by reading the pages, creating a Div

with a Paragraph with a Span, assigning the file text to the Span

and the Paragraph to the Div, and then adding the Divs one by one

to the TextFlow.

I want to be able to edit each page (Div) in a textarea. The proper

mapping unit is a Div; but the Div's textFlow property appears to

be the entire TextFlow, not some sub-TextFlow equal to the Div.

But the Div has no text property - there's only the getText method

- the Div provides no bindable hook.

If I write my own text() setter, when will it be called? If I need to

hook the textarea up to another Div (another page), how will I know

if I've edited the textarea but the setter hasn't been called yet?

I've tested doing that, but the setter seems never to happen.

Do I need to hook in to the Change() event on the textarea

manually? If so, what's the point of binding?

FInally, I'll know all this is working when I can make editing

changes to the active Div/Paragraph/Span, which cause the

length of the page text to change; and the changed length

has rippled though to change the absolute start position of

all the following pages. When does that happen, and do I

need to trigger it somehow?

This topic has been closed for replies.

1 reply

Adobe Employee
May 24, 2010

I don't think there's any way to bind just part of a TextFlow into a TextArea. You can, as you say, bind either a String or a completed TextFlow. If your text is very simple, binding just the string is easiest. But if it has multiple formats, or levels of hierarchy you wish to preserve, then you have to use the TextFlow.

For what you're doing, if you already know which text goes  on which page, based on what <div> it is in, and if the text in the div is single format, easiest would be to get the string value of the div (getText) and set that into the TextArea. If you have mutliple formats, you have to take the div and put it into its own TextFlow, and set that into the TextArea.

- robin