<?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; FxAnimateColor</title>
	<atom:link href="http://blog.flexexamples.com/category/spark/fxanimatecolor/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>Animating colors using the FxAnimateColor effect in Flex Gumbo</title>
		<link>http://blog.flexexamples.com/2008/11/06/animating-colors-using-the-fxanimatecolor-effect-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2008/11/06/animating-colors-using-the-fxanimatecolor-effect-in-flex-gumbo/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 06:59:48 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta]]></category>
		<category><![CDATA[Effects]]></category>
		<category><![CDATA[FxAnimateColor]]></category>
		<category><![CDATA[colorFrom]]></category>
		<category><![CDATA[colorTo]]></category>
		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/11/06/animating-colors-using-the-fxanimatecolor-effect-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows how you can create an animated transition between two colors using the Flex Gumbo FxAnimateColor class.</p> <p>Full code after the jump.</p> <p></p> <p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can create an animated transition between two colors using the Flex Gumbo FxAnimateColor class.</p>
<p>Full code after the jump.</p>
<p><span id="more-860"></span></p>
<p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see <a href="http://blog.flexexamples.com/2008/08/02/using-the-beta-gumbo-sdk-in-flex-builder-3/">&#8220;Using the beta Gumbo SDK in Flex Builder 3&#8243;</a>.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FxAnimateColor_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/11/06/animating-colors-using-the-fxanimatecolor-effect-in-flex-gumbo/ --&gt;
&lt;FxApplication name=&quot;FxAnimateColor_test&quot;
        xmlns=&quot;http://ns.adobe.com/mxml/2009&quot;&gt;

    &lt;Declarations&gt;
        &lt;FxAnimateColor id=&quot;fxAnimateColor&quot;
                colorFrom=&quot;{color1.selectedColor}&quot;
                colorTo=&quot;{color2.selectedColor}&quot;
                target=&quot;{ellipse.fill}&quot; /&gt;
    &lt;/Declarations&gt;

    &lt;Form&gt;
        &lt;FormItem label=&quot;colorFrom:&quot;&gt;
            &lt;ColorPicker id=&quot;color1&quot;
                    selectedColor=&quot;red&quot; /&gt;
        &lt;/FormItem&gt;
        &lt;FormItem label=&quot;colorTo:&quot;&gt;
            &lt;ColorPicker id=&quot;color2&quot;
                    selectedColor=&quot;blue&quot; /&gt;
        &lt;/FormItem&gt;
        &lt;FormItem&gt;
            &lt;Button id=&quot;btn&quot;
                    label=&quot;Play&quot;
                    click=&quot;fxAnimateColor.play();&quot; /&gt;
        &lt;/FormItem&gt;
    &lt;/Form&gt;

    &lt;Ellipse id=&quot;ellipse&quot;
            width=&quot;300&quot;
            height=&quot;200&quot;
            horizontalCenter=&quot;0&quot;
            verticalCenter=&quot;0&quot;&gt;
        &lt;fill&gt;
            &lt;SolidColor /&gt;
        &lt;/fill&gt;
    &lt;/Ellipse&gt;

&lt;/FxApplication&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/FxAnimateColor_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/FxAnimateColor_test/bin/main.html" width="100%" height="300"></iframe></p>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FxAnimateColor_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/11/06/animating-colors-using-the-fxanimatecolor-effect-in-flex-gumbo/ --&gt;
&lt;FxApplication name=&quot;FxAnimateColor_test&quot;
        xmlns=&quot;http://ns.adobe.com/mxml/2009&quot;
        initialize=&quot;init();&quot;&gt;

    &lt;Script&gt;
        &lt;![CDATA[
            import mx.containers.Form;
            import mx.containers.FormItem;
            import mx.controls.Button;
            import mx.controls.ColorPicker;
            import mx.effects.FxAnimateColor;
            import mx.events.ColorPickerEvent;
            import mx.graphics.Ellipse;
            import mx.graphics.SolidColor;

            private var btn:Button;
            private var color1:ColorPicker;
            private var color2:ColorPicker;
            private var ellipse:Ellipse;
            private var fxAnimateColor:FxAnimateColor;

            private function init():void {
                color1 = new ColorPicker();
                color1.selectedColor = 0xFF0000; // red;
                color1.addEventListener(ColorPickerEvent.CHANGE, color1_change);

                color2 = new ColorPicker();
                color2.selectedColor = 0x0000FF; // blue
                color2.addEventListener(ColorPickerEvent.CHANGE, color2_change);

                btn = new Button();
                btn.label = &quot;Play&quot;;
                btn.addEventListener(MouseEvent.CLICK, btn_click);

                var formItem1:FormItem = new FormItem();
                formItem1.label = &quot;colorFrom:&quot;;
                formItem1.addChild(color1);

                var formItem2:FormItem = new FormItem();
                formItem2.label = &quot;colorTo:&quot;;
                formItem2.addChild(color2);

                var formItem3:FormItem = new FormItem();
                formItem2.addChild(btn);

                var form:Form = new Form();
                form.addChild(formItem1);
                form.addChild(formItem2);
                form.addChild(formItem3);
                addItem(form);

                ellipse = new Ellipse();
                ellipse.fill = new SolidColor();
                ellipse.width = 300;
                ellipse.height = 200;
                ellipse.horizontalCenter = 0;
                ellipse.verticalCenter = 0;
                addItem(ellipse);

                fxAnimateColor = new FxAnimateColor();
                fxAnimateColor.colorFrom = color1.selectedColor;
                fxAnimateColor.colorTo = color2.selectedColor;
                fxAnimateColor.target = ellipse.fill;
            }

            private function color1_change(evt:ColorPickerEvent):void {
                fxAnimateColor.colorFrom = evt.color;
            }

            private function color2_change(evt:ColorPickerEvent):void {
                fxAnimateColor.colorTo = evt.color;
            }

            private function btn_click(evt:MouseEvent):void {
                fxAnimateColor.play();
            }
        ]]&gt;
    &lt;/Script&gt;

&lt;/FxApplication&gt;
</pre>
<p class="new">You can also just specify the <code>colorTo</code> property if you want to animate from the current color to a specific color:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FxAnimateColor_test/bin/srcview/source/main3.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/11/06/animating-colors-using-the-fxanimatecolor-effect-in-flex-gumbo/ --&gt;
&lt;FxApplication name=&quot;FxAnimateColor_test&quot;
        xmlns=&quot;http://ns.adobe.com/mxml/2009&quot;&gt;

    &lt;Declarations&gt;
        &lt;FxAnimateColor id=&quot;fxAnimateColor&quot;
                colorTo=&quot;{color2.selectedColor}&quot;
                target=&quot;{ellipse.fill}&quot; /&gt;
    &lt;/Declarations&gt;

    &lt;Form&gt;
        &lt;FormItem label=&quot;colorTo:&quot;&gt;
            &lt;ColorPicker id=&quot;color2&quot;
                    selectedColor=&quot;blue&quot; /&gt;
        &lt;/FormItem&gt;
        &lt;FormItem&gt;
            &lt;Button id=&quot;btn&quot;
                    label=&quot;Play&quot;
                    click=&quot;fxAnimateColor.play();&quot; /&gt;
        &lt;/FormItem&gt;
    &lt;/Form&gt;

    &lt;Ellipse id=&quot;ellipse&quot;
            width=&quot;300&quot;
            height=&quot;200&quot;
            horizontalCenter=&quot;0&quot;
            verticalCenter=&quot;0&quot;&gt;
        &lt;fill&gt;
            &lt;SolidColor /&gt;
        &lt;/fill&gt;
    &lt;/Ellipse&gt;

&lt;/FxApplication&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/FxAnimateColor_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/FxAnimateColor_test/bin/main3.html" width="100%" height="300"></iframe></p>
<p class="alert">This entry is based on a beta version of the Flex Gumbo 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 Gumbo SDK.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Animating colors using the FxAnimateColor effect in Flex Gumbo on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/11/06/animating-colors-using-the-fxanimatecolor-effect-in-flex-gumbo/',contentID: 'post-860',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'colorFrom,colorTo,Gumbo',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/2008/11/06/animating-colors-using-the-fxanimatecolor-effect-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

