<?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>The Burned Out Hippy &#187; HTML</title>
	<atom:link href="http://www.burnedouthippy.com/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.burnedouthippy.com</link>
	<description>~ Hugging Flash into submission ~</description>
	<lastBuildDate>Sun, 13 Jun 2010 13:17:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>The CSSLoader Class (v1.0)</title>
		<link>http://www.burnedouthippy.com/2009/08/the-cssloader-class-v1-0/</link>
		<comments>http://www.burnedouthippy.com/2009/08/the-cssloader-class-v1-0/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 17:15:48 +0000</pubDate>
		<dc:creator>The Hippy</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Classes]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[loader]]></category>
		<category><![CDATA[processor]]></category>
		<category><![CDATA[stylesheet]]></category>

		<guid isPermaLink="false">http://www.burnedouthippy.com/?p=37</guid>
		<description><![CDATA[AS3 is a wonderful thing, but it can be really long-winded sometimes when you&#8217;re trying to achieve something simple &#8211; the perfect example being the replacement of AS2&#8242;s getURL() class with a series of listeners. I know why it has been set up this way, I understand why it&#8217;s better that everything follows a uniform [...]]]></description>
			<content:encoded><![CDATA[<p>AS3 is a wonderful thing, but it can be really long-winded sometimes when you&#8217;re trying to achieve something simple &#8211; the perfect example being the replacement of AS2&#8242;s getURL() class with a series of listeners. I know why it has been set up this way, I understand why it&#8217;s better that everything follows a uniform methodology and I do wholeheartedly agree with it, but there is no getting around the fact that you can get bogged down writing the same long-winded code over and over again.  Frankly, it can be a pain in the ass and can sap the fun out of simple tasks.</p>
<p>Sometimes I get around these chunks of code using snippets (see <a href="http://www.gotoandlearn.com/play?id=94" target="_blank">Lee Brimelow&#8217;s tutorial on how to set up snippets in Flex Builder</a>), but sometimes the code is crying out for a simple class to be made &#8211; in my opinion, loading external stylesheets is one of these times.</p>
<p><span id="more-37"></span></p>
<p>If you google &#8220;actionscript 3 external stylesheets&#8221; you are very likely to come across <a href="http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&#038;file=00000232.html" target="_blank">this explanation</a> by Adobe. </p>
<p>Now don&#8217;t get me wrong, after studying it for a couple of minutes you&#8217;ll see that the code is pretty straightforward. Firstly it sets up a textfield, then an external file loader. Then it uses the file loader to load the stylesheet and when the stylesheet has been successfully loaded it applies the stylesheet to the textfield and adds the appropriate HTML text. Fine. Long-winded, but fine.</p>
<p>But this is exactly the kind of situation that frustrates me. If I wanted to load several stylesheets for several different textfields, I&#8217;d be backed up in a pile of repeating code setting up loaders and success/error functions. It makes much more sense to me to have a CSSLoader class that I can simply send the instance name of the textfield, the text that I want to put into the textfield and the name/path of the stylesheet file &#8211; and then let the class set up a loader and check that the file has loaded correctly. As I currently can&#8217;t think of a situation where this wouldn&#8217;t apply, that is exactly what I&#8217;ve done.</p>
<p><a href="http://www.burnedouthippy.com/downloads/CSSLoader/CSSLoader.zip" target="_blank">You can find the class here.</a><br />
<a href="http://www.burnedouthippy.com/downloads/CSSLoader/CSSLoader_example_files.zip" target="_blank">You can find example files here.</a></p>
<p>Now all you have to do is create a textfield and then type something similar to the following:</p>
<p><code>var cssLoader:CSSLoader = new CSSLoader(tfield, someText, "example.css");</code></p>
<p>Isn&#8217;t that easier? In this case, &#8220;tfield&#8221; is the instance name of the textfield, &#8220;someText&#8221; is a String containing the HTML text you want to format (eg taken from an XML node) and &#8220;example.css&#8221; is the name/path of the external stylesheet. The class does the rest for you &#8211; it takes the text, throws it into the textfield and styles it.  Much easier I&#8217;m sure you&#8217;ll agree and a lot less confusing when it comes to dealing with large numbers of textfields.</p>
<p>Please remember to set the textfield property &#8220;Multiline&#8221; to &#8220;true&#8221;, or else your HTML paragraph tags won&#8217;t work. Check out my <a href="http://www.burnedouthippy.com/downloads/CSSLoader/CSSLoader_eample_files.zip" target="_blank">basic example</a> to see that in action.</p>
<p>If you can think of any situation where this class may need extending, please let me know. I am open to friendly suggestion of expanding its usefulness. </p>
<p>However if you&#8217;re a hardcore developer and don&#8217;t agree with me simplifying something that is essentially pretty simple to start with &#8211; I apologise if I have offended your sensibility, but this works better for me. Please don&#8217;t spam me, I won&#8217;t reply. I&#8217;m here to help like-minded designer/developers, not to get into an argument. Cheers! <img src='http://www.burnedouthippy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.burnedouthippy.com/2009/08/the-cssloader-class-v1-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
