<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>distortion &#187; text</title>
	<atom:link href="http://www.giordanopiazza.com/blog/tag/text/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.giordanopiazza.com/blog</link>
	<description>gyo goes blogging</description>
	<lastBuildDate>Sun, 20 Jun 2010 11:05:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Adding line breaks in Flash via XML</title>
		<link>http://www.giordanopiazza.com/blog/flash/adding-line-breaks-in-flash-via-xml/</link>
		<comments>http://www.giordanopiazza.com/blog/flash/adding-line-breaks-in-flash-via-xml/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 13:09:16 +0000</pubDate>
		<dc:creator>gyo</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[as2]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[line-breaks]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.giordanopiazza.com/blog/?p=126</guid>
		<description><![CDATA[How to add a line break to a text coming from XML in Flash (AS2/AS3)? I've been trying with \n and \r, and &#60;br&#62; using HTML text and it was breaking the XML; it could have been fixed with &#60;![CDATA[ but I didn't like the solution, and in the end... I didn't want to use [...]]]></description>
			<content:encoded><![CDATA[<p>How to add a line break to a text coming from XML in Flash (AS2/AS3)?<br />
I've been trying with <strong>\n</strong> and <strong>\r</strong>, and <strong>&lt;br&gt;</strong> using HTML text and it was breaking the XML; it could have been fixed with <strong>&lt;![CDATA[ </strong>but I didn't like the solution, and in the end... I didn't want to use HTML text!</p>
<p>The answer was too easy, really:</p>
<hr />
<h2>&amp;#xD;</h2>
<hr />This simple characters combination made it. Just put this inside your XML's texts to have a line break. Cool.<br />
As many other times, I don't know why this is not advertised everywhere, it's the simplest and cleanest solution to add line breaks to a text field from XML.</p>
<p>Well, enjoy!<strong><span style="color: #ff0000;"> </span></strong></p>
<p><strong><span style="color: #ff0000;"> </span></strong>Now you can find a <a href="http://www.giordanopiazza.com/candybox/xml-line-breaks/example.swf" target="_blank">live example</a> and <a href="http://www.giordanopiazza.com/candybox/xml-line-breaks/xml_line_breaks.zip">download the sources</a>.</p>
<p><strong><span style="color: #ff0000;">UPDATE</span></strong></p>
<p>A guy left a review on Stumble saying: "<span>CDATA - Character Data. Use it. It's what it's there for".</span><span><br />
At the very beginning I wrote that I didn't like this solution, but now I'd like to give more information on why I <strong>DON'T</strong> like CDATA:</span></p>
<p>- It increases the file size<br />
- Your XML file becomes bloated and less readable<br />
- If you need a new line break (which is the point of this post) you have to actually make the new line in the XML, destroying the formatting</p>
<p>Here is an example:<br />
<code lang="xml"> &lt;items&gt;<br />
&lt;item&gt;&lt;![CDATA[This is the first line.<br />
And this goes on a new line.]]&gt;&lt;/item&gt;<br />
&lt;/items&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.giordanopiazza.com/blog/flash/adding-line-breaks-in-flash-via-xml/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
	</channel>
</rss>

