<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Formatting colors as strings with ActionScript</title>
	<atom:link href="http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Sun, 12 Feb 2012 14:19:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: daniel</title>
		<link>http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/comment-page-1/#comment-8745</link>
		<dc:creator>daniel</dc:creator>
		<pubDate>Fri, 17 Dec 2010 13:26:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/#comment-8745</guid>
		<description>Thank you, just what i was looking for</description>
		<content:encoded><![CDATA[<p>Thank you, just what i was looking for</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/comment-page-1/#comment-7920</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Wed, 16 Jun 2010 00:59:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/#comment-7920</guid>
		<description>Fantastic post... exactly what I needed.</description>
		<content:encoded><![CDATA[<p>Fantastic post&#8230; exactly what I needed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/comment-page-1/#comment-7719</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Mon, 17 May 2010 00:51:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/#comment-7719</guid>
		<description>Thats what this function does (or is supposed to):
&lt;pre lang=&quot;mxml&quot;&gt;
    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function intToHex(color:int = 0):String {
                var mask:String = &quot;000000&quot;;
                var str:String = mask + color.toString(16).toUpperCase()
                return &quot;#&quot; + str.substr(str.length - 6);
            }
        ]]&gt;
    &lt;/mx:Script&gt;
&lt;/pre&gt;

So if the color is returned as &quot;FF&quot;, it prepends &quot;000000&quot; giving us &quot;000000FF&quot; and then takes the last 6 chars (giving us &quot;0000FF&quot;), and then we prefix it with a &quot;#&quot;.

Peter</description>
		<content:encoded><![CDATA[<p>Thats what this function does (or is supposed to):</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;">    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            private function intToHex(color:int = 0):String {</span>
<span style="color: #339933;">                var mask:String = &quot;000000&quot;;</span>
<span style="color: #339933;">                var str:String = mask + color.toString(16).toUpperCase()</span>
<span style="color: #339933;">                return &quot;#&quot; + str.substr(str.length - 6);</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span></pre></div></div>

<p>So if the color is returned as &#8220;FF&#8221;, it prepends &#8220;000000&#8243; giving us &#8220;000000FF&#8221; and then takes the last 6 chars (giving us &#8220;0000FF&#8221;), and then we prefix it with a &#8220;#&#8221;.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: UX flex</title>
		<link>http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/comment-page-1/#comment-7718</link>
		<dc:creator>UX flex</dc:creator>
		<pubDate>Mon, 17 May 2010 00:20:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/#comment-7718</guid>
		<description>Thank you. There are several algorithms out there that purport to do this, and yours is the only one I&#039;ve found which actually works. The difficult element is ensuring that for blue, the algorithm returns #0000ff, and not #ff.
OK I&#039;m going to yelling bloody murder at my computer now.</description>
		<content:encoded><![CDATA[<p>Thank you. There are several algorithms out there that purport to do this, and yours is the only one I&#8217;ve found which actually works. The difficult element is ensuring that for blue, the algorithm returns #0000ff, and not #ff.<br />
OK I&#8217;m going to yelling bloody murder at my computer now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikos Katsikanis</title>
		<link>http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/comment-page-1/#comment-79</link>
		<dc:creator>Nikos Katsikanis</dc:creator>
		<pubDate>Wed, 13 Aug 2008 08:20:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/#comment-79</guid>
		<description>Ah I see, thanks very much for you quick response. This is one of the best sities for learning flex, I&#039;m going through every example.</description>
		<content:encoded><![CDATA[<p>Ah I see, thanks very much for you quick response. This is one of the best sities for learning flex, I&#8217;m going through every example.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/comment-page-1/#comment-81</link>
		<dc:creator>peterd</dc:creator>
		<pubDate>Tue, 12 Aug 2008 14:00:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/#comment-81</guid>
		<description>Nikos Katsikanis,

I prefixed with &quot;000000&quot; so that the color black will display as #000000 instead of #0, and green would be #00FF00 instead of #FF00. Basically it was to ensure that the formatted number would always be six characters long.

Peter</description>
		<content:encoded><![CDATA[<p>Nikos Katsikanis,</p>
<p>I prefixed with &#8220;000000&#8243; so that the color black will display as #000000 instead of #0, and green would be #00FF00 instead of #FF00. Basically it was to ensure that the formatted number would always be six characters long.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikos Katsikanis</title>
		<link>http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/comment-page-1/#comment-80</link>
		<dc:creator>Nikos Katsikanis</dc:creator>
		<pubDate>Tue, 12 Aug 2008 08:05:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/#comment-80</guid>
		<description>Thanks for this example. I was wondering why you prefix 000000 to the String?</description>
		<content:encoded><![CDATA[<p>Thanks for this example. I was wondering why you prefix 000000 to the String?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ozgur Uksal</title>
		<link>http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/comment-page-1/#comment-82</link>
		<dc:creator>Ozgur Uksal</dc:creator>
		<pubDate>Sat, 26 Jul 2008 14:29:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/#comment-82</guid>
		<description>pretty helpful</description>
		<content:encoded><![CDATA[<p>pretty helpful</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BC</title>
		<link>http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/comment-page-1/#comment-78</link>
		<dc:creator>BC</dc:creator>
		<pubDate>Wed, 07 May 2008 04:02:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/#comment-78</guid>
		<description>wow, very nice</description>
		<content:encoded><![CDATA[<p>wow, very nice</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/comment-page-1/#comment-77</link>
		<dc:creator>peterd</dc:creator>
		<pubDate>Tue, 31 Jul 2007 15:59:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/25/formatting-colors-as-strings-with-actionscript/#comment-77</guid>
		<description>Ultraniblet,

There is a ColorPicker control in the Flex framework (look in the mx.controls package).

You can find the Flex 2.0.1 ColorPicker documentation online at &lt;a href=&quot;http://livedocs.adobe.com/flex/201/langref/mx/controls/ColorPicker.html&quot; rel=&quot;nofollow&quot;&gt;http://livedocs.adobe.com/flex/201/langref/mx/controls/ColorPicker.html&lt;/a&gt; or the beta Flex 3 documentation at &lt;a href=&quot;http://livedocs.adobe.com/labs/flex/3/langref/mx/controls/ColorPicker.html&quot; rel=&quot;nofollow&quot;&gt;http://livedocs.adobe.com/labs/flex/3/langref/mx/controls/ColorPicker.html&lt;/a&gt;.

I also just wrote a brief post on it at: &lt;a href=&quot;http://blog.flexexamples.com/2007/07/31/using-the-colorpicker-controls-colorfield-and-labelfield-properties/&quot; rel=&quot;nofollow&quot;&gt;&quot;Using the ColorPicker control’s colorField and labelField properties&quot;&lt;/a&gt;.

Hope that helps,

Peter</description>
		<content:encoded><![CDATA[<p>Ultraniblet,</p>
<p>There is a ColorPicker control in the Flex framework (look in the mx.controls package).</p>
<p>You can find the Flex 2.0.1 ColorPicker documentation online at <a href="http://livedocs.adobe.com/flex/201/langref/mx/controls/ColorPicker.html" rel="nofollow">http://livedocs.adobe.com/flex/201/langref/mx/controls/ColorPicker.html</a> or the beta Flex 3 documentation at <a href="http://livedocs.adobe.com/labs/flex/3/langref/mx/controls/ColorPicker.html" rel="nofollow">http://livedocs.adobe.com/labs/flex/3/langref/mx/controls/ColorPicker.html</a>.</p>
<p>I also just wrote a brief post on it at: <a href="http://blog.flexexamples.com/2007/07/31/using-the-colorpicker-controls-colorfield-and-labelfield-properties/" rel="nofollow">&#8220;Using the ColorPicker control’s colorField and labelField properties&#8221;</a>.</p>
<p>Hope that helps,</p>
<p>Peter</p>
]]></content:encoded>
	</item>
</channel>
</rss>

