<?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>Deviouswork &#187; htmltext</title>
	<atom:link href="http://www.deviouswork.com/tag/htmltext/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.deviouswork.com</link>
	<description>Flash development for hire</description>
	<lastBuildDate>Tue, 18 Oct 2011 13:47:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Ordered Lists in TextField.htmlText</title>
		<link>http://www.deviouswork.com/2009/04/21/ordered-lists-in-textfieldhtmltext/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ordered-lists-in-textfieldhtmltext</link>
		<comments>http://www.deviouswork.com/2009/04/21/ordered-lists-in-textfieldhtmltext/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 12:21:59 +0000</pubDate>
		<dc:creator>Joakim Roos</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Labs]]></category>
		<category><![CDATA[htmltext]]></category>
		<category><![CDATA[li]]></category>
		<category><![CDATA[ul]]></category>

		<guid isPermaLink="false">http://www.deviouswork.com/?p=240</guid>
		<description><![CDATA[One thing thats kept bugging me with TextField.htmlText was the lack of support for ordered list (&#60;ol&#62;&#60;li&#62;&#60;/li&#62;&#60;/ol&#62;) in a textfield with htmlText applied to it. I decided to write a simple class that strips a html string from the (&#60;ol&#62;&#60;li&#62;&#60;/li&#62;&#60;/ol&#62;) and arrange the list(s) in numerical order with tabs instead. I know this isn&#8217;t the [...]]]></description>
			<content:encoded><![CDATA[<p>One thing thats kept bugging me with TextField.htmlText was the lack of support for ordered list <strong>(&lt;ol&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;)</strong> in a textfield with htmlText applied to it. I decided to write a simple class that strips a html string from the <strong>(&lt;ol&gt;&lt;li&gt;&lt;/li&gt;&lt;/ol&gt;)</strong> and arrange the list(s) in numerical order with tabs instead. I know this isn&#8217;t the prettiest, but hey it works.<span id="more-240"></span></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p240code2'); return false;">View Code</a> AS3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2402"><td class="code" id="p240code2"><pre class="as3" style="font-family:monospace;"><span style="color: #3f5fbf;">/**
 * com.deviouswork.util.HTMLUtil
 * @version 1.0.0
 * @author Joakim Roos | j  at deviouswork dot com
 * 
 * Copyright (c) 2009 Deviouswork
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the &quot;Software&quot;), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */</span>
<span style="color: #9900cc; font-weight: bold;">package</span> com<span style="color: #000066; font-weight: bold;">.</span>deviouswork<span style="color: #000066; font-weight: bold;">.</span>util <span style="color: #000000;">&#123;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * HTMLUtil
	 */</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> HTMLUtil <span style="color: #000000;">&#123;</span>		
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> orderedList<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">,</span> tabs<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">String</span> <span style="color: #000000;">&#123;</span>				
			<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">indexOf</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;&lt;ol&gt;&quot;</span><span style="color: #000000;">&#41;</span> == <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> tab_str <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">while</span><span style="color: #000000;">&#40;</span>tabs<span style="color: #000066; font-weight: bold;">--</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
					tab_str <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;<span style="">\t</span>&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #000000;">&#125;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> orderedList_array <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">split</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;&lt;/ol&gt;&lt;ol&gt;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> numberedList_str<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = orderedList_array<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> orderedList_array<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
					<span style="color: #6699cc; font-weight: bold;">var</span> listItem_array <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #004993;">String</span><span style="color: #000000;">&#40;</span>orderedList_array<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">split</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;&lt;li&gt;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">slice</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> j<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> j <span style="color: #000066; font-weight: bold;">&lt;</span> listItem_array<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000066; font-weight: bold;">;</span> j<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
						<span style="color: #6699cc; font-weight: bold;">var</span> list_str<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #004993;">String</span><span style="color: #000000;">&#40;</span>j<span style="color: #000066; font-weight: bold;">+</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot;.&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> tab_str <span style="color: #000066; font-weight: bold;">+</span> HTMLUtil<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">replace</span><span style="color: #000000;">&#40;</span>listItem_array<span style="color: #000000;">&#91;</span>j<span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #990000;">&quot;[<span style="">\n</span>]&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;&lt;br&gt;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
						list_str = HTMLUtil<span style="color: #000066; font-weight: bold;">.</span>remove<span style="color: #000000;">&#40;</span>list_str<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;[<span style="">\r</span>]&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
						list_str = HTMLUtil<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">replace</span><span style="color: #000000;">&#40;</span>list_str<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;&lt;br /&gt;&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;&lt;br /&gt;&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> tab_str<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
						list_str = HTMLUtil<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">replace</span><span style="color: #000000;">&#40;</span>list_str<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;&lt;br /&gt;&quot;</span> <span style="color: #000066; font-weight: bold;">+</span>tab_str <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot;<span style="">\t</span>&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;&lt;br /&gt;&lt;br /&gt;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>					
						numberedList_str <span style="color: #000066; font-weight: bold;">+</span>= list_str<span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #000000;">&#125;</span>
				<span style="color: #000000;">&#125;</span>
				HTMLUtil<span style="color: #000066; font-weight: bold;">.</span>remove<span style="color: #000000;">&#40;</span>numberedList_str<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;&lt;/ol&gt;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">return</span> numberedList_str<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #339966; font-weight: bold;">function</span> remove<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">,</span> remove<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> HTMLUtil<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">replace</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">,</span> remove<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">''</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">private</span> static <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">replace</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">,</span> remove<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">replace</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> pattern<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">RegExp</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">RegExp</span><span style="color: #000000;">&#40;</span>remove<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">'g'</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">source</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">replace</span><span style="color: #000000;">&#40;</span>pattern<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">replace</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.deviouswork.com/2009/04/21/ordered-lists-in-textfieldhtmltext/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

