Question

When working with CSS inside of XML such as

<span class="IwuvAS3"></span>

when parsed in flash, if I don't use CDATA like the following:

<![CDATA[<span class="IwuvAS3"></span>]]>

then the parsed data drops down a line for every "<" character it sees.

When parsing the data into a single-line text field, nothing was shown because it was actually down a line. Soon as I wrap it inside of CDATA it works great. I have played with prettyIndent, and as I understand ignoreWhite is true by default.

Is there a way to parse the data without the use of CDATA and keep the implied line breaks out?

EDIT 1 (10/10/08): Thank you, but I am actually looking for a Function or Method. Escaping each is much more cumbersome than using CDATA. The only reason I don't want to use CDATA is that I was taught to stay clear of it. If ActionScript has a method associated to E4X XML handling that will remove the requirement to wrap my XML in CDATA, I would love to know about it.

EDIT 1 (10/15/08): Thanks Philippe! I never would have thought that HTML formatting in Flash is treated as whitespace. The answer was

textField.condenseWhite = true;

<3AS3

Was it helpful?

Solution

Set the TextField's condenseWhite property to true - so only < br/> tags will generate linebreaks.

OTHER TIPS

You could escape the "<" characters (and &, ", >, ', among others) as entities instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top