Skip to main content
Participant
April 5, 2010
Question

deepCopy() behaviour

  • April 5, 2010
  • 1 reply
  • 447 views

Hi all,

Having been pounding my head against the wall for a couple of days I just wanted to give you heads up on what I discovered.
Don't know if this behaviour has already been documented but I've not found any useful info about this.

I have a TLF-editor that saves TLF-formatted text to a MySQL database.
So far so good, if I retrieve the TLF-formatted text to a TLF-viewer or the TLF-editor, it all looks right.

But if I, (as in this case), want to create a summary of a couple of these database texts, (i.e. for printing), things started to break.

As the TLF does not support "appending" the only way I could glue these texts together is by making a deepCopy() of all of the childElements in these separate texts and add these to a new TextFlow.
However if there is a spanElement surrounding one word, (bold, italic, underlined, strikethrough, make your pick), the whiteSpace between this word and the words before and after are gone.

textFlow.whiteSpaceCollapse = "preserve" has no effect.
Nor has textFlow.whiteSpaceCollapse = flashx.textLayout.formats.WhiteSpaceCollapse.PRESERVE;

And since I am importing a preformatted string (as a string) from the database straight into the textFlow I could not have imagined I'd have to use XML commands to get textFlow import working.

Anyway, XML.prettyPrinting = false; before the import call fixes this.

For safety I use this combo.

XML.ignoreWhitespace = false;
XML.prettyPrinting = false;

Note, this behaviour is showing only when the target is created with StringTextLineFactory.

This topic has been closed for replies.

1 reply

FMG2010Author
Participant
April 5, 2010

I just saw that this has been up before and even fixed.

Allthough it did not show up on my searches.