<?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>Flex Examples &#187; brightness</title>
	<atom:link href="http://blog.flexexamples.com/tag/brightness/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Converting colors from HSB to RGB format in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/10/17/converting-colors-from-hsb-to-rgb-format-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/10/17/converting-colors-from-hsb-to-rgb-format-in-flex-4/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 06:59:51 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta2]]></category>
		<category><![CDATA[HSBColor (Spark)]]></category>
		<category><![CDATA[brightness]]></category>
		<category><![CDATA[convertHSBtoRGB()]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[hue]]></category>
		<category><![CDATA[saturation]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=2036</guid>
		<description><![CDATA[<p>The following example shows how you can convert a color from it&#8217;s HSB (Hue/Saturation/Brightness) format to standard RGB (Red/Green/Blue) format using the static HSBColor.convertHSBtoRGB() method.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2009/10/17/converting-colors-from-hsb-to-rgb-format-in-flex-4/ --&#62; &#60;s:Application name=&#34;Spark_HSBColor_convertHSBtoRGB_test&#34; xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/halo&#34;&#62; &#60;s:controlBarContent&#62; &#60;mx:Form&#62; &#60;mx:FormItem label=&#34;hue:&#34;&#62; &#60;s:HSlider id=&#34;hueSl&#34; minimum=&#34;0&#34; maximum=&#34;360&#34; valueCommit=&#34;setColor();&#34; /&#62; &#60;/mx:FormItem&#62; &#60;mx:FormItem label=&#34;saturation:&#34;&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can convert a color from it&#8217;s HSB (Hue/Saturation/Brightness) format to standard RGB (Red/Green/Blue) format using the static <code>HSBColor.convertHSBtoRGB()</code> method.</p>
<p>Full code after the jump.</p>
<p><span id="more-2036"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/10/17/converting-colors-from-hsb-to-rgb-format-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_HSBColor_convertHSBtoRGB_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;hue:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HSlider</span> id=<span style="color: #ff0000;">&quot;hueSl&quot;</span></span>
<span style="color: #000000;">                        minimum=<span style="color: #ff0000;">&quot;0&quot;</span></span>
<span style="color: #000000;">                        maximum=<span style="color: #ff0000;">&quot;360&quot;</span></span>
<span style="color: #000000;">                        valueCommit=<span style="color: #ff0000;">&quot;setColor();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;saturation:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HSlider</span> id=<span style="color: #ff0000;">&quot;saturationSl&quot;</span></span>
<span style="color: #000000;">                        minimum=<span style="color: #ff0000;">&quot;0.0&quot;</span></span>
<span style="color: #000000;">                        maximum=<span style="color: #ff0000;">&quot;1.0&quot;</span></span>
<span style="color: #000000;">                        value=<span style="color: #ff0000;">&quot;1.0&quot;</span></span>
<span style="color: #000000;">                        snapInterval=<span style="color: #ff0000;">&quot;0.01&quot;</span></span>
<span style="color: #000000;">                        stepSize=<span style="color: #ff0000;">&quot;0.01&quot;</span></span>
<span style="color: #000000;">                        valueCommit=<span style="color: #ff0000;">&quot;setColor();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;brightness:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HSlider</span> id=<span style="color: #ff0000;">&quot;brightnessSl&quot;</span></span>
<span style="color: #000000;">                        minimum=<span style="color: #ff0000;">&quot;0.0&quot;</span></span>
<span style="color: #000000;">                        maximum=<span style="color: #ff0000;">&quot;1.0&quot;</span></span>
<span style="color: #000000;">                        value=<span style="color: #ff0000;">&quot;1.0&quot;</span></span>
<span style="color: #000000;">                        snapInterval=<span style="color: #ff0000;">&quot;0.01&quot;</span></span>
<span style="color: #000000;">                        stepSize=<span style="color: #ff0000;">&quot;0.01&quot;</span></span>
<span style="color: #000000;">                        valueCommit=<span style="color: #ff0000;">&quot;setColor();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            import mx.utils.HSBColor;</span>
&nbsp;
<span style="color: #000000;">            private function setColor<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                brdr.setStyle<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;backgroundColor&quot;</span>, rgbColor<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function formatRGB<span style="color: #66cc66;">&#40;</span>value:uint<span style="color: #66cc66;">&#41;</span>:String <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var str:String = String<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;000000&quot;</span> + value.toString<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.substr<span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;">6</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                return <span style="color: #ff0000;">&quot;#&quot;</span> + str.toUpperCase<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:uint</span> id=<span style="color: #ff0000;">&quot;rgbColor&quot;</span><span style="color: #7400FF;">&gt;</span></span>{HSBColor.convertHSBtoRGB(hueSl.value, saturationSl.value, brightnessSl.value)}<span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:uint</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Border</span> id=<span style="color: #ff0000;">&quot;brdr&quot;</span></span>
<span style="color: #000000;">            left=<span style="color: #ff0000;">&quot;20&quot;</span> right=<span style="color: #ff0000;">&quot;20&quot;</span> top=<span style="color: #ff0000;">&quot;20&quot;</span> bottom=<span style="color: #ff0000;">&quot;20&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;lbl&quot;</span></span>
<span style="color: #000000;">                text=<span style="color: #ff0000;">&quot;{formatRGB(rgbColor)}&quot;</span></span>
<span style="color: #000000;">                fontSize=<span style="color: #ff0000;">&quot;96&quot;</span></span>
<span style="color: #000000;">                blendMode=<span style="color: #ff0000;">&quot;invert&quot;</span></span>
<span style="color: #000000;">                horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Border</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Converting colors from HSB to RGB format in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/10/17/converting-colors-from-hsb-to-rgb-format-in-flex-4/',contentID: 'post-2036',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'brightness,convertHSBtoRGB(),Gumbo,hue,saturation',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/10/17/converting-colors-from-hsb-to-rgb-format-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Modifying a color&#8217;s saturation in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/10/16/modifying-a-colors-saturation-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/10/16/modifying-a-colors-saturation-in-flex-4/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 05:51:27 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta2]]></category>
		<category><![CDATA[HSBColor (Spark)]]></category>
		<category><![CDATA[brightness]]></category>
		<category><![CDATA[convertHSBtoRGB()]]></category>
		<category><![CDATA[convertRGBtoHSB()]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[hue]]></category>
		<category><![CDATA[saturation]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=2029</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2009/10/14/modifying-a-colors-brightness-in-flex-4/">&#8220;Modifying a color&#8217;s brightness in Flex 4&#8243;</a>, we saw how you could modify a color&#8217;s brightness in Flex 4 by using the static HSBColor.convertRGBtoHSB() and HSBColor.convertHSBtoRGB() methods and the brightness property.</p> <p>The following example shows how you can modify a color&#8217;s saturation in Flex 4 by using the static HSBColor.convertRGBtoHSB() [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2009/10/14/modifying-a-colors-brightness-in-flex-4/">&#8220;Modifying a color&#8217;s brightness in Flex 4&#8243;</a>, we saw how you could modify a color&#8217;s brightness in Flex 4 by using the static <code>HSBColor.convertRGBtoHSB()</code> and <code>HSBColor.convertHSBtoRGB()</code> methods and the <code>brightness</code> property.</p>
<p>The following example shows how you can modify a color&#8217;s saturation in Flex 4 by using the static <code>HSBColor.convertRGBtoHSB()</code> and <code>HSBColor.convertHSBtoRGB()</code> methods and the <code>saturation</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-2029"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/10/16/modifying-a-colors-saturation-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_HSBColor_saturation_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span></span>
<span style="color: #000000;">        creationComplete=<span style="color: #ff0000;">&quot;setSaturation();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Form</span> backgroundAlpha=<span style="color: #ff0000;">&quot;0.0&quot;</span> paddingTop=<span style="color: #ff0000;">&quot;0&quot;</span> paddingBottom=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;color:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ColorPicker</span> id=<span style="color: #ff0000;">&quot;colorPicker&quot;</span></span>
<span style="color: #000000;">                        selectedColor=<span style="color: #ff0000;">&quot;red&quot;</span></span>
<span style="color: #000000;">                        change=<span style="color: #ff0000;">&quot;setSaturation();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;saturation:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HSlider</span> id=<span style="color: #ff0000;">&quot;slider&quot;</span></span>
<span style="color: #000000;">                        minimum=<span style="color: #ff0000;">&quot;0.0&quot;</span> maximum=<span style="color: #ff0000;">&quot;1.0&quot;</span></span>
<span style="color: #000000;">                        value=<span style="color: #ff0000;">&quot;1.0&quot;</span></span>
<span style="color: #000000;">                        snapInterval=<span style="color: #ff0000;">&quot;0.01&quot;</span> stepSize=<span style="color: #ff0000;">&quot;0.01&quot;</span></span>
<span style="color: #000000;">                        valueCommit=<span style="color: #ff0000;">&quot;setSaturation();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            import mx.utils.HSBColor;</span>
&nbsp;
<span style="color: #000000;">            protected function modifySaturation<span style="color: #66cc66;">&#40;</span>color:uint, saturation:Number<span style="color: #66cc66;">&#41;</span>:uint <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var hsbColor:HSBColor = HSBColor.convertRGBtoHSB<span style="color: #66cc66;">&#40;</span>color<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                hsbColor.saturation = saturation;</span>
<span style="color: #000000;">                return HSBColor.convertHSBtoRGB<span style="color: #66cc66;">&#40;</span>hsbColor.hue, hsbColor.saturation, hsbColor.brightness<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function setSaturation<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                fillCol.color = modifySaturation<span style="color: #66cc66;">&#40;</span>colorPicker.selectedColor, slider.value<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function formatRGB<span style="color: #66cc66;">&#40;</span>value:uint<span style="color: #66cc66;">&#41;</span>:String <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var str:String = String<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;000000&quot;</span> + value.toString<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.substr<span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;">6</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                return <span style="color: #ff0000;">&quot;#&quot;</span> + str.toUpperCase<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> id=<span style="color: #ff0000;">&quot;rect&quot;</span></span>
<span style="color: #000000;">            left=<span style="color: #ff0000;">&quot;50&quot;</span> right=<span style="color: #ff0000;">&quot;50&quot;</span> top=<span style="color: #ff0000;">&quot;50&quot;</span> bottom=<span style="color: #ff0000;">&quot;50&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> id=<span style="color: #ff0000;">&quot;fillCol&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;lbl&quot;</span></span>
<span style="color: #000000;">            text=<span style="color: #ff0000;">&quot;{formatRGB(fillCol.color)}&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Modifying a color\&#039;s saturation in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/10/16/modifying-a-colors-saturation-in-flex-4/',contentID: 'post-2029',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'brightness,convertHSBtoRGB(),convertRGBtoHSB(),Gumbo,hue,saturation',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/10/16/modifying-a-colors-saturation-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modifying a color&#8217;s brightness in Flex 4</title>
		<link>http://blog.flexexamples.com/2009/10/14/modifying-a-colors-brightness-in-flex-4/</link>
		<comments>http://blog.flexexamples.com/2009/10/14/modifying-a-colors-brightness-in-flex-4/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 00:38:09 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta2]]></category>
		<category><![CDATA[HSBColor (Spark)]]></category>
		<category><![CDATA[brightness]]></category>
		<category><![CDATA[convertHSBtoRGB()]]></category>
		<category><![CDATA[convertRGBtoHSB()]]></category>
		<category><![CDATA[Gumbo]]></category>
		<category><![CDATA[hue]]></category>
		<category><![CDATA[saturation]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/?p=2017</guid>
		<description><![CDATA[<p>The following example shows how you can modify a color&#8217;s brightness in Flex 4 by using the static HSBColor.convertRGBtoHSB() and HSBColor.convertHSBtoRGB() methods and the brightness property.</p> <p>Full code after the jump.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2009/10/14/modifying-a-colors-brightness-in-flex-4/ --&#62; &#60;s:Application name=&#34;Spark_HSBColor_convertHSBtoRGB_test&#34; xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/halo&#34; creationComplete=&#34;setBrightness();&#34;&#62; &#60;s:controlBarContent&#62; &#60;mx:Form backgroundAlpha=&#34;0.0&#34; paddingTop=&#34;0&#34; paddingBottom=&#34;0&#34;&#62; &#60;mx:FormItem label=&#34;color:&#34;&#62; &#60;mx:ColorPicker id=&#34;colorPicker&#34; selectedColor=&#34;red&#34; change=&#34;setBrightness();&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can modify a color&#8217;s brightness in Flex 4 by using the static <code>HSBColor.convertRGBtoHSB()</code> and <code>HSBColor.convertHSBtoRGB()</code> methods and the <code>brightness</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-2017"></span></p>
<p class="alert">The following example(s) require Flash Player 10 and the Adobe Flex 4 SDK. To download the Adobe Flash Builder 4 trial, see <a href="http://bit.ly/crThlI">http://www.adobe.com/products/flex/</a>. To download the latest nightly build of the Flex 4 SDK, see <a href="http://bit.ly/Flex4SDK">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a>.<br/><strong>For more information on getting started with Flex 4 and Flash Builder 4, see the official <a href="http://bit.ly/dCkecm">Adobe Flex Team blog</a>.</strong></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2009/10/14/modifying-a-colors-brightness-in-flex-4/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_HSBColor_convertHSBtoRGB_test&quot;</span></span>
<span style="color: #000000;">        xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">        xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span></span>
<span style="color: #000000;">        creationComplete=<span style="color: #ff0000;">&quot;setBrightness();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Form</span> backgroundAlpha=<span style="color: #ff0000;">&quot;0.0&quot;</span> paddingTop=<span style="color: #ff0000;">&quot;0&quot;</span> paddingBottom=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;color:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ColorPicker</span> id=<span style="color: #ff0000;">&quot;colorPicker&quot;</span></span>
<span style="color: #000000;">                        selectedColor=<span style="color: #ff0000;">&quot;red&quot;</span></span>
<span style="color: #000000;">                        change=<span style="color: #ff0000;">&quot;setBrightness();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;brightness:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:HSlider</span> id=<span style="color: #ff0000;">&quot;slider&quot;</span></span>
<span style="color: #000000;">                        minimum=<span style="color: #ff0000;">&quot;0.0&quot;</span> maximum=<span style="color: #ff0000;">&quot;1.0&quot;</span></span>
<span style="color: #000000;">                        value=<span style="color: #ff0000;">&quot;1.0&quot;</span></span>
<span style="color: #000000;">                        snapInterval=<span style="color: #ff0000;">&quot;0.01&quot;</span> stepSize=<span style="color: #ff0000;">&quot;0.01&quot;</span></span>
<span style="color: #000000;">                        valueCommit=<span style="color: #ff0000;">&quot;setBrightness();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:controlBarContent</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">            import mx.utils.HSBColor;</span>
&nbsp;
<span style="color: #000000;">            protected function modifyBrightness<span style="color: #66cc66;">&#40;</span>color:uint, brightness:Number<span style="color: #66cc66;">&#41;</span>:uint <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var hsbColor:HSBColor = HSBColor.convertRGBtoHSB<span style="color: #66cc66;">&#40;</span>color<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                hsbColor.brightness = brightness;</span>
<span style="color: #000000;">                return HSBColor.convertHSBtoRGB<span style="color: #66cc66;">&#40;</span>hsbColor.hue, hsbColor.saturation, hsbColor.brightness<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function setBrightness<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                fillCol.color = modifyBrightness<span style="color: #66cc66;">&#40;</span>colorPicker.selectedColor, slider.value<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function formatRGB<span style="color: #66cc66;">&#40;</span>value:uint<span style="color: #66cc66;">&#41;</span>:String <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                var str:String = String<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;000000&quot;</span> + value.toString<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.substr<span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;">6</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                return <span style="color: #ff0000;">&quot;#&quot;</span> + str.toUpperCase<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">        <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> id=<span style="color: #ff0000;">&quot;rect&quot;</span></span>
<span style="color: #000000;">            left=<span style="color: #ff0000;">&quot;50&quot;</span> right=<span style="color: #ff0000;">&quot;50&quot;</span> top=<span style="color: #ff0000;">&quot;50&quot;</span> bottom=<span style="color: #ff0000;">&quot;50&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> id=<span style="color: #ff0000;">&quot;fillCol&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;lbl&quot;</span></span>
<span style="color: #000000;">            text=<span style="color: #ff0000;">&quot;{formatRGB(fillCol.color)}&quot;</span></span>
<span style="color: #000000;">            horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> bottom=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_HSBColor_brightness_test/bin/srcview/">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/spark/Spark_HSBColor_brightness_test/bin/main.html" width="100%" height="300"></iframe></p>
<p class="alert">This entry is based on a beta version of the Flex 4 SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex 4 SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Modifying a color\&#039;s brightness in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2009/10/14/modifying-a-colors-brightness-in-flex-4/',contentID: 'post-2017',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'brightness,convertHSBtoRGB(),convertRGBtoHSB(),Gumbo,hue,saturation',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2009/10/14/modifying-a-colors-brightness-in-flex-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

