<?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; SolidColor</title>
	<atom:link href="http://blog.flexexamples.com/category/solidcolor/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>Creating a solid color fill on a Spark Ellipse object in Flex 4</title>
		<link>http://blog.flexexamples.com/2008/11/26/creating-a-solid-color-fill-on-an-ellipse-object-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2008/11/26/creating-a-solid-color-fill-on-an-ellipse-object-in-flex-gumbo/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 14:47:48 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[beta]]></category>
		<category><![CDATA[Ellipse]]></category>
		<category><![CDATA[FXG]]></category>
		<category><![CDATA[SolidColor]]></category>
		<category><![CDATA[fill]]></category>
		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/11/26/creating-a-solid-color-fill-on-an-ellipse-object-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows how you can create a solid color fill on a Spark Ellipse object in Flex 4 by setting the fill property to a SolidColor object.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2008/11/26/creating-a-solid-color-fill-on-an-ellipse-object-in-flex-gumbo/ --&#62; &#60;s:Application name=&#34;Spark_Ellipse_fill_solidColor_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/mx&#34;&#62; &#60;s:controlBarContent&#62; &#60;mx:Form&#62; &#60;mx:FormItem label=&#34;color:&#34;&#62; &#60;mx:ColorPicker id=&#34;colorPicker&#34; /&#62; &#60;/mx:FormItem&#62; &#60;mx:FormItem label=&#34;alpha:&#34;&#62; &#60;s:HSlider id=&#34;slider&#34; minimum=&#34;0.0&#34; maximum=&#34;1.0&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can create a solid color fill on a Spark Ellipse object in Flex 4 by setting the <code>fill</code> property to a SolidColor object.</p>
<p><span id="more-878"></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/2008/11/26/creating-a-solid-color-fill-on-an-ellipse-object-in-flex-gumbo/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Ellipse_fill_solidColor_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/mx&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;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 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;alpha:&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></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.1&quot;</span></span>
<span style="color: #000000;">                        stepSize=<span style="color: #ff0000;">&quot;0.1&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;s:Ellipse</span> id=<span style="color: #ff0000;">&quot;ellipse&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;300&quot;</span> height=<span style="color: #ff0000;">&quot;200&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:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> color=<span style="color: #ff0000;">&quot;{colorPicker.selectedColor}&quot;</span></span>
<span style="color: #000000;">                    alpha=<span style="color: #ff0000;">&quot;{slider.value}&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:Ellipse</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/Ellipse_fill_solidColor_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/Ellipse_fill_solidColor_test/bin/main_4178.html" width="100%" height="300"></iframe></p>
<p>You can also set the SolidColor object&#8217;s <code>color</code> and <code>alpha</code> properties using ActionScript, as seen in the following example:</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/2008/11/26/creating-a-solid-color-fill-on-an-ellipse-object-in-flex-gumbo/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Ellipse_fill_solidColor_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/mx&quot;</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.events.ColorPickerEvent;</span>
&nbsp;
<span style="color: #000000;">            protected function colorPicker_changeHandler<span style="color: #66cc66;">&#40;</span>evt:ColorPickerEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                solidColor.color = evt.color;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function slider_changeHandler<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                solidColor.alpha = evt.currentTarget.value;</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: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;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;">                        change=<span style="color: #ff0000;">&quot;colorPicker_changeHandler(event);&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;alpha:&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></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.1&quot;</span></span>
<span style="color: #000000;">                        stepSize=<span style="color: #ff0000;">&quot;0.1&quot;</span></span>
<span style="color: #000000;">                        change=<span style="color: #ff0000;">&quot;slider_changeHandler(event);&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;s:Ellipse</span> id=<span style="color: #ff0000;">&quot;ellipse&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;300&quot;</span> height=<span style="color: #ff0000;">&quot;200&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: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;solidColor&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:Ellipse</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>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</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/2008/11/26/creating-a-solid-color-fill-on-an-ellipse-object-in-flex-gumbo/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> name=<span style="color: #ff0000;">&quot;Spark_Ellipse_fill_solidColor_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/mx&quot;</span></span>
<span style="color: #000000;">        initialize=<span style="color: #ff0000;">&quot;init();&quot;</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.containers.Form;</span>
<span style="color: #000000;">            import mx.containers.FormItem;</span>
<span style="color: #000000;">            import mx.controls.ColorPicker;</span>
<span style="color: #000000;">            import mx.events.ColorPickerEvent;</span>
<span style="color: #000000;">            import mx.graphics.SolidColor;</span>
<span style="color: #000000;">            import spark.components.HSlider;</span>
<span style="color: #000000;">            import spark.primitives.Ellipse;</span>
&nbsp;
<span style="color: #000000;">            protected var colorPicker:ColorPicker;</span>
<span style="color: #000000;">            protected var slider:HSlider;</span>
<span style="color: #000000;">            protected var ellipse:Ellipse;</span>
<span style="color: #000000;">            protected var solidColor:SolidColor;</span>
&nbsp;
<span style="color: #000000;">            protected function init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                colorPicker = new ColorPicker<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                colorPicker.addEventListener<span style="color: #66cc66;">&#40;</span>ColorPickerEvent.CHANGE, colorPicker_changeHandler<span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                slider = new HSlider<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                slider.minimum = <span style="color: #cc66cc;">0.0</span>;</span>
<span style="color: #000000;">                slider.maximum = <span style="color: #cc66cc;">1.0</span>;</span>
<span style="color: #000000;">                slider.value = <span style="color: #cc66cc;">1.0</span>;</span>
<span style="color: #000000;">                slider.snapInterval = <span style="color: #cc66cc;">0.1</span>;</span>
<span style="color: #000000;">                slider.stepSize = <span style="color: #cc66cc;">0.1</span>;</span>
<span style="color: #000000;">                slider.addEventListener<span style="color: #66cc66;">&#40;</span>Event.CHANGE, slider_changeHandler<span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                var formItem1:FormItem = new FormItem<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                formItem1.label = <span style="color: #ff0000;">&quot;color:&quot;</span>;</span>
<span style="color: #000000;">                formItem1.addElement<span style="color: #66cc66;">&#40;</span>colorPicker<span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                var formItem2:FormItem = new FormItem<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                formItem2.label = <span style="color: #ff0000;">&quot;alpha:&quot;</span>;</span>
<span style="color: #000000;">                formItem2.addElement<span style="color: #66cc66;">&#40;</span>slider<span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                var form:Form = new Form<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                form.addElement<span style="color: #66cc66;">&#40;</span>formItem1<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                form.addElement<span style="color: #66cc66;">&#40;</span>formItem2<span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                this.controlBarContent = <span style="color: #66cc66;">&#91;</span>form<span style="color: #66cc66;">&#93;</span>;</span>
&nbsp;
<span style="color: #000000;">                solidColor = new SolidColor<span style="color: #66cc66;">&#40;</span>colorPicker.selectedColor, slider.value<span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">                ellipse = new Ellipse<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">                ellipse.fill = solidColor;</span>
<span style="color: #000000;">                ellipse.width = <span style="color: #cc66cc;">300</span>;</span>
<span style="color: #000000;">                ellipse.height = <span style="color: #cc66cc;">200</span>;</span>
<span style="color: #000000;">                ellipse.horizontalCenter = <span style="color: #cc66cc;">0</span>;</span>
<span style="color: #000000;">                ellipse.verticalCenter = <span style="color: #cc66cc;">0</span>;</span>
<span style="color: #000000;">                addElement<span style="color: #66cc66;">&#40;</span>ellipse<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 colorPicker_changeHandler<span style="color: #66cc66;">&#40;</span>evt:ColorPickerEvent<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                solidColor.color = evt.color;</span>
<span style="color: #000000;">            <span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">            protected function slider_changeHandler<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">                solidColor.alpha = evt.currentTarget.value;</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: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: 'Creating a solid color fill on a Spark Ellipse object in Flex 4 on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/11/26/creating-a-solid-color-fill-on-an-ellipse-object-in-flex-gumbo/',contentID: 'post-878',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'fill,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/26/creating-a-solid-color-fill-on-an-ellipse-object-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using graphical and text primitives in Flex Gumbo</title>
		<link>http://blog.flexexamples.com/2008/10/30/using-graphical-and-text-primitives-in-flex-gumbo/</link>
		<comments>http://blog.flexexamples.com/2008/10/30/using-graphical-and-text-primitives-in-flex-gumbo/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 08:03:20 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Ellipse]]></category>
		<category><![CDATA[FXG]]></category>
		<category><![CDATA[SolidColor]]></category>
		<category><![CDATA[group]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/10/30/using-graphical-and-text-primitives-in-flex-gumbo/</guid>
		<description><![CDATA[<p>The following example shows you how to draw an ellipse in a Flex Gumbo application using the new Ellipse graphic primitive in FXG.</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 [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows you how to draw an ellipse in a Flex Gumbo application using the new Ellipse graphic primitive in FXG.</p>
<p>Full code after the jump.</p>
<p><span id="more-850"></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/FXG_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/30/using-graphical-and-text-primitives-in-flex-gumbo/ --&gt;
&lt;FxApplication name="FXG_test"
        xmlns="http://ns.adobe.com/mxml/2009"&gt;
    &lt;layout&gt;
        &lt;BasicLayout /&gt;
    &lt;/layout&gt;

    &lt;Ellipse id="ellipse"
            width="100"
            height="100"
            horizontalCenter="0"
            verticalCenter="0"&gt;
        &lt;fill&gt;
            &lt;SolidColor color="red" /&gt;
        &lt;/fill&gt;
    &lt;/Ellipse&gt;

&lt;/FxApplication&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/FXG_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/FXG_test/bin/main.html" width="100%" height="200"></iframe></p>
<p>You could also create a custom component from the Ellipse with the FXG namespace, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FXG_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/30/using-graphical-and-text-primitives-in-flex-gumbo/ --&gt;
&lt;FxApplication name="FXG_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        xmlns:comps="comps.*"&gt;
    &lt;layout&gt;
        &lt;BasicLayout /&gt;
    &lt;/layout&gt;

    &lt;comps:RedEllipse id="ellipse"
            horizontalCenter="0"
            verticalCenter="0" /&gt;

&lt;/FxApplication&gt;
</pre>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FXG_test/bin/srcview/source/comps/RedEllipse.fxg">comps/RedEllipse.fxg</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/30/using-graphical-and-text-primitives-in-flex-gumbo/ --&gt;
&lt;Ellipse xmlns="http://ns.adobe.com/fxg/2008"
        width="100"
        height="100"&gt;
    &lt;fill&gt;
        &lt;SolidColor color="red" /&gt;
    &lt;/fill&gt;
&lt;/Ellipse&gt;
</pre>
<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/FXG_test/bin/srcview/source/main3.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/30/using-graphical-and-text-primitives-in-flex-gumbo/ --&gt;
&lt;FxApplication name="FXG_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        initialize="init();"&gt;
    &lt;layout&gt;
        &lt;BasicLayout /&gt;
    &lt;/layout&gt;

    &lt;Script&gt;
        &lt;![CDATA[
            import mx.graphics.Ellipse;
            import mx.graphics.SolidColor;

            private var ellipse:Ellipse;

            private function init():void {
                ellipse = new Ellipse();
                ellipse.fill = new SolidColor(0xFF0000);
                ellipse.width = 100;
                ellipse.height = 100;
                ellipse.horizontalCenter = 0;
                ellipse.verticalCenter = 0;
                addItem(ellipse);
            }
        ]]&gt;
    &lt;/Script&gt;

&lt;/FxApplication&gt;
</pre>
<p>However, if you were using the &lt;Application /&gt; tag instead of the &lt;FxApplication /&gt; tag, the syntax is slightly different.<br />
First, if you tried to use an Ellipse graphic primitive as a direct child of a Halo container (Application, Panel, Canvas, etc.), you would currently get a compiler error saying the following:</p>
<blockquote><p>
&#8216;Ellipse&#8217; declaration must be contained within the &lt;Declarations&gt; tag since it does not implement mx.core.IUIComponent.
</p></blockquote>
<p>To get around this you need to wrap the Ellipse (or other graphic primitives such as BitmapGraphic, Path, Rect, TextGraphic, TextBox, etc) in within a Group class instance (or one of its subclasses such as HGroup, VGroup, Graphic, MXMLComponent, or Skin).</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FXG_test/bin/srcview/source/main4.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/30/using-graphical-and-text-primitives-in-flex-gumbo/ --&gt;
&lt;Application name="FXG_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="absolute"
        backgroundColor="white"&gt;

    &lt;Group id="group"
            horizontalCenter="0"
            verticalCenter="0"&gt;
        &lt;Ellipse id="ellipse"
                width="100"
                height="100"&gt;
            &lt;fill&gt;
                &lt;SolidColor color="red" /&gt;
            &lt;/fill&gt;
        &lt;/Ellipse&gt;
    &lt;/Group&gt;

&lt;/Application&gt;
</pre>
<p>You could also create a custom component from the Ellipse with the FXG namespace, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FXG_test/bin/srcview/source/main5.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/30/using-graphical-and-text-primitives-in-flex-gumbo/ --&gt;
&lt;Application name="FXG_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        xmlns:comps="comps.*"
        layout="absolute"
        backgroundColor="white"&gt;

    &lt;Group id="group"
            horizontalCenter="0"
            verticalCenter="0"&gt;
        &lt;comps:RedEllipse id="ellipse" /&gt;
    &lt;/Group&gt;

&lt;/Application&gt;
</pre>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FXG_test/bin/srcview/source/comps/RedEllipse.fxg">comps/RedEllipse.fxg</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/30/using-graphical-and-text-primitives-in-flex-gumbo/ --&gt;
&lt;Ellipse xmlns="http://ns.adobe.com/fxg/2008"
        width="100"
        height="100"&gt;
    &lt;fill&gt;
        &lt;SolidColor color="red" /&gt;
    &lt;/fill&gt;
&lt;/Ellipse&gt;
</pre>
<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/FXG_test/bin/srcview/source/main6.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/10/30/using-graphical-and-text-primitives-in-flex-gumbo/ --&gt;
&lt;Application name="FXG_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        layout="absolute"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;Script&gt;
        &lt;![CDATA[
            import mx.components.Group;
            import mx.graphics.Ellipse;
            import mx.graphics.SolidColor;

            private var group:Group;
            private var ellipse:Ellipse;

            private function init():void {
                ellipse = new Ellipse();
                ellipse.fill = new SolidColor(0xFF0000);
                ellipse.width = 100;
                ellipse.height = 100;

                group = new Group();
                group.setStyle("horizontalCenter", 0);
                group.setStyle("verticalCenter", 0);
                group.addItem(ellipse);
                addChild(group);
            }
        ]]&gt;
    &lt;/Script&gt;

&lt;/Application&gt;
</pre>
<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>
<p>For more information see the <a href="http://opensource.adobe.com/wiki/display/flexsdk/FXG+1.0+Specification">FXG 1.0 Specification</a> page at opensource.adobe.com.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Using graphical and text primitives in Flex Gumbo on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/10/30/using-graphical-and-text-primitives-in-flex-gumbo/',contentID: 'post-850',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'group',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/10/30/using-graphical-and-text-primitives-in-flex-gumbo/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Adding a stroke around a ColumnSeries item in a Flex ColumnChart control</title>
		<link>http://blog.flexexamples.com/2007/11/22/adding-a-stroke-around-a-columnseries-item-in-a-flex-columnchart-control/</link>
		<comments>http://blog.flexexamples.com/2007/11/22/adding-a-stroke-around-a-columnseries-item-in-a-flex-columnchart-control/#comments</comments>
		<pubDate>Thu, 22 Nov 2007 08:43:47 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[ColumnChart]]></category>
		<category><![CDATA[SolidColor]]></category>
		<category><![CDATA[fill]]></category>
		<category><![CDATA[stroke]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/22/adding-a-stroke-around-a-columnseries-item-in-a-flex-columnchart-control/</guid>
		<description><![CDATA[<p>The following example shows how you can add a stroke around chart items in a Flex ColumnChart control.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ColumnSeries_stroke_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0"?&#62; &#60;!-- http://blog.flexexamples.com/2007/11/22/adding-a-stroke-around-a-columnseries-item-in-a-flex-columnchart-control/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.charts.chartClasses.IAxis; private function linearAxis_labelFunc(item:Object, prevValue:Object, axis:IAxis):String { return currencyFormatter.format(item); } private function categoryAxis_labelFunc(item:Object, prevValue:Object, [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can add a stroke around chart items in a Flex ColumnChart control.</p>
<p>Full code after the jump.</p>
<p><span id="more-325"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/ColumnSeries_stroke_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/22/adding-a-stroke-around-a-columnseries-item-in-a-flex-columnchart-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.charts.chartClasses.IAxis;

            private function linearAxis_labelFunc(item:Object, prevValue:Object, axis:IAxis):String {
                return currencyFormatter.format(item);
            }

            private function categoryAxis_labelFunc(item:Object, prevValue:Object, axis:CategoryAxis, categoryItem:Object):String {
                var datNum:Number = Date.parse(item);
                var tempDate:Date = new Date(datNum);
                return dateFormatter.format(tempDate).toUpperCase();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:DateFormatter id="dateFormatter" formatString="DD" /&gt;
    &lt;mx:CurrencyFormatter id="currencyFormatter" precision="2" /&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;quote date="8/1/2007" open="40.29" close="39.58" /&gt;
                &lt;quote date="8/2/2007" open="39.4" close="39.52" /&gt;
                &lt;quote date="8/3/2007" open="39.47" close="38.75" /&gt;
                &lt;quote date="8/6/2007" open="38.71" close="39.38" /&gt;
                &lt;quote date="8/7/2007" open="39.08" close="39.42" /&gt;
                &lt;quote date="8/8/2007" open="39.61" close="40.23" /&gt;
                &lt;quote date="8/9/2007" open="39.9" close="40.75" /&gt;
                &lt;quote date="8/10/2007" open="41.3" close="41.06" /&gt;
                &lt;quote date="8/13/2007" open="41" close="40.83" /&gt;
                &lt;quote date="8/14/2007" open="41.01" close="40.41" /&gt;
                &lt;quote date="8/15/2007" open="40.22" close="40.18" /&gt;
                &lt;quote date="8/16/2007" open="39.83" close="39.96" /&gt;
                &lt;quote date="8/17/2007" open="40.18" close="40.32" /&gt;
                &lt;quote date="8/20/2007" open="40.55" close="40.74" /&gt;
                &lt;quote date="8/21/2007" open="40.41" close="40.13" /&gt;
                &lt;quote date="8/22/2007" open="40.4" close="40.77" /&gt;
                &lt;quote date="8/23/2007" open="40.82" close="40.6" /&gt;
                &lt;quote date="8/24/2007" open="40.5" close="40.41" /&gt;
                &lt;quote date="8/27/2007" open="40.38" close="40.81" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ColumnChart id="columnChart"
            showDataTips="true"
            dataProvider="{dp}"
            width="100%"
            height="100%"&gt;

        &lt;mx:backgroundElements&gt;
            &lt;mx:GridLines&gt;
                &lt;mx:horizontalStroke&gt;
                    &lt;mx:Stroke color="haloSilver" weight="0" /&gt;
                &lt;/mx:horizontalStroke&gt;
            &lt;/mx:GridLines&gt;
        &lt;/mx:backgroundElements&gt;

        &lt;!-- vertical axis --&gt;
        &lt;mx:verticalAxis&gt;
            &lt;mx:LinearAxis baseAtZero="false"
                    labelFunction="linearAxis_labelFunc" /&gt;
        &lt;/mx:verticalAxis&gt;

        &lt;!-- horizontal axis --&gt;
        &lt;mx:horizontalAxis&gt;
            &lt;mx:CategoryAxis id="ca"
                    categoryField="@date"
                    title="August 2007"
                    labelFunction="categoryAxis_labelFunc" /&gt;
        &lt;/mx:horizontalAxis&gt;

        &lt;!-- horizontal axis renderer --&gt;
        &lt;mx:horizontalAxisRenderers&gt;
            &lt;mx:AxisRenderer axis="{ca}"
                    canDropLabels="true" /&gt;
        &lt;/mx:horizontalAxisRenderers&gt;

        &lt;!-- series --&gt;
        &lt;mx:series&gt;
            &lt;mx:ColumnSeries displayName="Open"
                    xField="@date"
                    yField="@open"&gt;
                &lt;mx:stroke&gt;
                    &lt;mx:Stroke color="black" weight="2" alpha="1.0" /&gt;
                &lt;/mx:stroke&gt;
                &lt;mx:fill&gt;
                    &lt;mx:SolidColor color="haloBlue" alpha="0.9" /&gt;
                &lt;/mx:fill&gt;
            &lt;/mx:ColumnSeries&gt;
        &lt;/mx:series&gt;

        &lt;!-- series filters --&gt;
        &lt;mx:seriesFilters&gt;
            &lt;mx:Array /&gt;
        &lt;/mx:seriesFilters&gt;
    &lt;/mx:ColumnChart&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/ColumnSeries_stroke_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/ColumnSeries_stroke_test/bin/main.html" width="100%" height="500"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Adding a stroke around a ColumnSeries item in a Flex ColumnChart control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/22/adding-a-stroke-around-a-columnseries-item-in-a-flex-columnchart-control/',contentID: 'post-325',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'fill,stroke',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/2007/11/22/adding-a-stroke-around-a-columnseries-item-in-a-flex-columnchart-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alternating background row colors in a Flex LineSeries chart</title>
		<link>http://blog.flexexamples.com/2007/11/15/alternating-background-row-colors-in-a-flex-lineseries-chart/</link>
		<comments>http://blog.flexexamples.com/2007/11/15/alternating-background-row-colors-in-a-flex-lineseries-chart/#comments</comments>
		<pubDate>Fri, 16 Nov 2007 02:58:20 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[GridLines]]></category>
		<category><![CDATA[LineChart]]></category>
		<category><![CDATA[SolidColor]]></category>
		<category><![CDATA[backgroundElements]]></category>
		<category><![CDATA[horizontalAlternateFill]]></category>
		<category><![CDATA[horizontalFill]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/15/alternating-background-row-colors-in-a-flex-lineseries-chart/</guid>
		<description><![CDATA[<p>The following example shows how you can alternate background row colors in a LineSeries chart in Flex by setting the horizontalAlternateFill style in the GridLines object, as seen in the following snippet:</p> &#60;mx:LineChart showDataTips=&#34;true&#34; dataProvider=&#34;{dp}&#34;&#62; &#60;mx:backgroundElements&#62; &#60;mx:GridLines&#62; &#60;mx:horizontalAlternateFill&#62; &#60;mx:SolidColor color=&#34;haloSilver&#34; alpha=&#34;0.25&#34; /&#62; &#60;/mx:horizontalAlternateFill&#62; &#60;/mx:GridLines&#62; &#60;/mx:backgroundElements&#62; &#60;/mx:LineChart&#62; <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/GridLines_horizontalAlternateFill_test/main.mxml">View [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can alternate background row colors in a LineSeries chart in Flex by setting the <code>horizontalAlternateFill</code> style in the GridLines object, as seen in the following snippet:</p>
<pre class="code">
&lt;mx:LineChart showDataTips=&quot;true&quot; dataProvider=&quot;{dp}&quot;&gt;

    &lt;mx:backgroundElements&gt;
        &lt;mx:GridLines&gt;
            <span style="color:red;">&lt;mx:horizontalAlternateFill&gt;
                &lt;mx:SolidColor color=&quot;haloSilver&quot; alpha=&quot;0.25&quot; /&gt;
            &lt;/mx:horizontalAlternateFill&gt;</span>
        &lt;/mx:GridLines&gt;
    &lt;/mx:backgroundElements&gt;

&lt;/mx:LineChart&gt;
</pre>
<p>Full code after the jump.</p>
<p><span id="more-303"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/GridLines_horizontalAlternateFill_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/15/alternating-background-row-colors-in-a-flex-lineseries-chart/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;quote date="8/27/2007" open="40.38" close="40.81" /&gt;
                &lt;quote date="8/24/2007" open="40.5" close="40.41" /&gt;
                &lt;quote date="8/23/2007" open="40.82" close="40.6" /&gt;
                &lt;quote date="8/22/2007" open="40.4" close="40.77" /&gt;
                &lt;quote date="8/21/2007" open="40.41" close="40.13" /&gt;
                &lt;quote date="8/20/2007" open="40.55" close="40.74" /&gt;
                &lt;quote date="8/17/2007" open="40.18" close="40.32" /&gt;
                &lt;quote date="8/16/2007" open="39.83" close="39.96" /&gt;
                &lt;quote date="8/15/2007" open="40.22" close="40.18" /&gt;
                &lt;quote date="8/14/2007" open="41.01" close="40.41" /&gt;
                &lt;quote date="8/13/2007" open="41" close="40.83" /&gt;
                &lt;quote date="8/10/2007" open="41.3" close="41.06" /&gt;
                &lt;quote date="8/9/2007" open="39.9" close="40.75" /&gt;
                &lt;quote date="8/8/2007" open="39.61" close="40.23" /&gt;
                &lt;quote date="8/7/2007" open="39.08" close="39.42" /&gt;
                &lt;quote date="8/6/2007" open="38.71" close="39.38" /&gt;
                &lt;quote date="8/3/2007" open="39.47" close="38.75" /&gt;
                &lt;quote date="8/2/2007" open="39.4" close="39.52" /&gt;
                &lt;quote date="8/1/2007" open="40.29" close="39.58" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:LineChart id="lineChart"
            showDataTips="true"
            dataProvider="{dp}"
            width="100%"
            height="100%"&gt;

        &lt;mx:backgroundElements&gt;
            &lt;mx:GridLines&gt;
                &lt;mx:horizontalAlternateFill&gt;
                    &lt;mx:SolidColor color="haloSilver" alpha="0.25" /&gt;
                &lt;/mx:horizontalAlternateFill&gt;
            &lt;/mx:GridLines&gt;
        &lt;/mx:backgroundElements&gt;

        &lt;!-- vertical axis --&gt;
        &lt;mx:verticalAxis&gt;
            &lt;mx:LinearAxis baseAtZero="false" title="Price" /&gt;
        &lt;/mx:verticalAxis&gt;

        &lt;!-- horizontal axis --&gt;
        &lt;mx:horizontalAxis&gt;
            &lt;mx:CategoryAxis id="ca" categoryField="@date" title="Date" /&gt;
        &lt;/mx:horizontalAxis&gt;

        &lt;!-- horizontal axis renderer --&gt;
        &lt;mx:horizontalAxisRenderers&gt;
            &lt;mx:AxisRenderer axis="{ca}" canDropLabels="true" /&gt;
        &lt;/mx:horizontalAxisRenderers&gt;

        &lt;!-- series --&gt;
        &lt;mx:series&gt;
            &lt;mx:LineSeries yField="@open" form="curve" displayName="Open" /&gt;
        &lt;/mx:series&gt;
    &lt;/mx:LineChart&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/GridLines_horizontalAlternateFill_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/GridLines_horizontalAlternateFill_test/bin/main.html" width="100%" height="500"></iframe></p>
<p>You can also change the <code>horizontalAlternateFill</code> style using CSS, as seen in the following snippet.</p>
<pre class="code">
&lt;mx:Style&gt;
    GridLines {
        horizontalAlternateFill: haloSilver;
    }
&lt;/mx:Style&gt;
</pre>
<p>Note that when using CSS, you set the <code>horizontalAlternateFill</code> style to a color name, not a SolidColor object.</p>
<p>If you want to change the <code>horizontalAlternateFill</code> style using ActionScript, you can use one of the following snippets:</p>
<pre class="code">
myGridLines.setStyle("horizontalAlternateFill", "haloSilver");
</pre>
<pre class="code">
import mx.graphics.SolidColor;
...
var solidColor:SolidColor = new SolidColor(0xFF0000, 0.2);
myGridLines.setStyle("horizontalAlternateFill", solidColor);
</pre>
<p>Note that you must pass a numeric value to the SolidColor constructor (or the SolidColor instance&#8217;s <code>color</code> property). If you want to use a named color (such as &#8220;red&#8221;, or &#8220;haloSilver&#8221;), you can use the static <code>StyleManager.getColorName()</code> method, as seen in the following snippet:</p>
<pre class="code">
import mx.graphics.SolidColor;
import mx.styles.StyleManager;
...
var colorAsNumber:uint = StyleManager.getColorName("haloBlue");
var solidColor:SolidColor = new SolidColor(colorAsNumber, 0.1);
myGridLines.setStyle("horizontalAlternateFill", solidColor);
</pre>
<p>You can also alternate row colors using the horizontalFill style, or use both the <code>horizontalFill</code> and <code>horizontalAlternateFill</code> styles to set the fill colors for both odd and even rows, as seen in the following snippet:</p>
<pre class="code">
&lt;mx:backgroundElements&gt;
    &lt;mx:GridLines direction=&quot;both&quot;&gt;
        <span style="color:red;">&lt;mx:horizontalFill&gt;
            &lt;mx:SolidColor color=&quot;haloBlue&quot; /&gt;
        &lt;/mx:horizontalFill&gt;
        &lt;mx:horizontalAlternateFill&gt;
            &lt;mx:SolidColor color=&quot;haloSilver&quot; /&gt;
        &lt;/mx:horizontalAlternateFill&gt;</span>
    &lt;/mx:GridLines&gt;
&lt;/mx:backgroundElements&gt;
</pre>
<p>The following example shows how you can alternate the row colors for even and odd numbered rows by setting both the <code>horizontalFill</code> and <code>horizontalAlternateFill</code> styles using MXML:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/GridLines_horizontalFill_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/15/alternating-background-row-colors-in-a-flex-lineseries-chart/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;quote date="8/27/2007" open="40.38" close="40.81" /&gt;
                &lt;quote date="8/24/2007" open="40.5" close="40.41" /&gt;
                &lt;quote date="8/23/2007" open="40.82" close="40.6" /&gt;
                &lt;quote date="8/22/2007" open="40.4" close="40.77" /&gt;
                &lt;quote date="8/21/2007" open="40.41" close="40.13" /&gt;
                &lt;quote date="8/20/2007" open="40.55" close="40.74" /&gt;
                &lt;quote date="8/17/2007" open="40.18" close="40.32" /&gt;
                &lt;quote date="8/16/2007" open="39.83" close="39.96" /&gt;
                &lt;quote date="8/15/2007" open="40.22" close="40.18" /&gt;
                &lt;quote date="8/14/2007" open="41.01" close="40.41" /&gt;
                &lt;quote date="8/13/2007" open="41" close="40.83" /&gt;
                &lt;quote date="8/10/2007" open="41.3" close="41.06" /&gt;
                &lt;quote date="8/9/2007" open="39.9" close="40.75" /&gt;
                &lt;quote date="8/8/2007" open="39.61" close="40.23" /&gt;
                &lt;quote date="8/7/2007" open="39.08" close="39.42" /&gt;
                &lt;quote date="8/6/2007" open="38.71" close="39.38" /&gt;
                &lt;quote date="8/3/2007" open="39.47" close="38.75" /&gt;
                &lt;quote date="8/2/2007" open="39.4" close="39.52" /&gt;
                &lt;quote date="8/1/2007" open="40.29" close="39.58" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:LineChart id="lineChart"
            showDataTips="true"
            dataProvider="{dp}"
            width="100%"
            height="100%"&gt;

        &lt;mx:backgroundElements&gt;
            &lt;mx:GridLines direction="both"&gt;
                &lt;mx:horizontalFill&gt;
                    &lt;mx:SolidColor color="haloBlue" alpha="0.6" /&gt;
                &lt;/mx:horizontalFill&gt;
                &lt;mx:horizontalAlternateFill&gt;
                    &lt;mx:SolidColor color="haloSilver" alpha="0.6" /&gt;
                &lt;/mx:horizontalAlternateFill&gt;
            &lt;/mx:GridLines&gt;
        &lt;/mx:backgroundElements&gt;

        &lt;!-- vertical axis --&gt;
        &lt;mx:verticalAxis&gt;
            &lt;mx:LinearAxis baseAtZero="false" title="Price" /&gt;
        &lt;/mx:verticalAxis&gt;

        &lt;!-- horizontal axis --&gt;
        &lt;mx:horizontalAxis&gt;
            &lt;mx:CategoryAxis id="ca" categoryField="@date" title="Date" /&gt;
        &lt;/mx:horizontalAxis&gt;

        &lt;!-- horizontal axis renderer --&gt;
        &lt;mx:horizontalAxisRenderers&gt;
            &lt;mx:AxisRenderer axis="{ca}" canDropLabels="true" /&gt;
        &lt;/mx:horizontalAxisRenderers&gt;

        &lt;!-- series --&gt;
        &lt;mx:series&gt;
            &lt;mx:LineSeries yField="@open" form="curve" displayName="Open" /&gt;
        &lt;/mx:series&gt;
    &lt;/mx:LineChart&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/GridLines_horizontalFill_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/GridLines_horizontalFill_test/bin/main.html" width="100%" height="500"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Alternating background row colors in a Flex LineSeries chart on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/15/alternating-background-row-colors-in-a-flex-lineseries-chart/',contentID: 'post-303',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'backgroundElements,horizontalAlternateFill,horizontalFill',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/2007/11/15/alternating-background-row-colors-in-a-flex-lineseries-chart/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Drawing transparent pie wedges in a Flex PieChart control</title>
		<link>http://blog.flexexamples.com/2007/11/11/drawing-transparent-pie-wedges-in-a-flex-piechart-control/</link>
		<comments>http://blog.flexexamples.com/2007/11/11/drawing-transparent-pie-wedges-in-a-flex-piechart-control/#comments</comments>
		<pubDate>Sun, 11 Nov 2007 15:23:49 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[PieSeries]]></category>
		<category><![CDATA[SolidColor]]></category>
		<category><![CDATA[fills]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/11/drawing-transparent-pie-wedges-in-a-flex-piechart-control/</guid>
		<description><![CDATA[<p>The following example shows how you can create transparent wedges in a Flex PieChart control by setting the SolidColor object&#8217;s alpha property to 0, as seen in the following snippet:</p> &#60;mx:PieChart dataProvider=&#34;{arrColl}&#34; height=&#34;100%&#34; width=&#34;100%&#34;&#62; &#60;mx:series&#62; &#60;mx:PieSeries id=&#34;pieSeries&#34; field=&#34;data&#34;&#62; &#60;mx:fills&#62; &#60;mx:SolidColor alpha=&#34;0.0&#34; /&#62; &#60;mx:SolidColor color=&#34;haloBlue&#34; alpha=&#34;1.0&#34; /&#62; &#60;/mx:fills&#62; &#60;mx:filters&#62; &#60;mx:Array /&#62; &#60;/mx:filters&#62; &#60;/mx:PieSeries&#62; &#60;/mx:series&#62; &#60;/mx:PieChart&#62; <p>Full [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can create transparent wedges in a Flex PieChart control by setting the SolidColor object&#8217;s <code>alpha</code> property to 0, as seen in the following snippet:</p>
<pre class="code">
&lt;mx:PieChart dataProvider=&quot;{arrColl}&quot; height=&quot;100%&quot; width=&quot;100%&quot;&gt;
    &lt;mx:series&gt;
        &lt;mx:PieSeries id=&quot;pieSeries&quot; field=&quot;data&quot;&gt;
            &lt;mx:fills&gt;
                <span style="color:red;">&lt;mx:SolidColor alpha=&quot;0.0&quot; /&gt;</span>
                &lt;mx:SolidColor color=&quot;haloBlue&quot; alpha=&quot;1.0&quot; /&gt;
            &lt;/mx:fills&gt;
            &lt;mx:filters&gt;
                &lt;mx:Array /&gt;
            &lt;/mx:filters&gt;
        &lt;/mx:PieSeries&gt;
    &lt;/mx:series&gt;
&lt;/mx:PieChart&gt;
</pre>
<p>Full code after the jump.</p>
<p><span id="more-290"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fills_test_3/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/11/drawing-transparent-pie-wedges-in-a-flex-piechart-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:ArrayCollection id="arrColl"&gt;
        &lt;mx:source&gt;
            &lt;mx:Array&gt;
                &lt;mx:Object label="Product 1" data="4" /&gt;
                &lt;mx:Object label="Product 2" data="27" /&gt;
            &lt;/mx:Array&gt;
        &lt;/mx:source&gt;
    &lt;/mx:ArrayCollection&gt;

    &lt;mx:PieChart id="pieChart"
            dataProvider="{arrColl}"
            height="100%"
            width="100%"
            showDataTips="true"&gt;
        &lt;mx:series&gt;
            &lt;mx:PieSeries id="pieSeries"
                    field="data"&gt;
                &lt;mx:fills&gt;
                    &lt;mx:SolidColor alpha="0.0" /&gt;
                    &lt;mx:SolidColor color="haloBlue" alpha="1.0" /&gt;
                &lt;/mx:fills&gt;
                &lt;mx:filters&gt;
                    &lt;mx:Array /&gt;
                &lt;/mx:filters&gt;
            &lt;/mx:PieSeries&gt;
        &lt;/mx:series&gt;
    &lt;/mx:PieChart&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fills_test_3/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fills_test_3/bin/main.html" width="100%" height="400"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Drawing transparent pie wedges in a Flex PieChart control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/11/drawing-transparent-pie-wedges-in-a-flex-piechart-control/',contentID: 'post-290',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'fills',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/2007/11/11/drawing-transparent-pie-wedges-in-a-flex-piechart-control/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Changing the default fill colors in a Flex PieChart control</title>
		<link>http://blog.flexexamples.com/2007/11/11/changing-the-default-fill-colors-in-a-flex-piechart-control/</link>
		<comments>http://blog.flexexamples.com/2007/11/11/changing-the-default-fill-colors-in-a-flex-piechart-control/#comments</comments>
		<pubDate>Sun, 11 Nov 2007 07:13:55 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[PieSeries]]></category>
		<category><![CDATA[SolidColor]]></category>
		<category><![CDATA[fills]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/11/changing-the-default-fill-colors-in-a-flex-piechart-control/</guid>
		<description><![CDATA[<p>The following examples show how you can change the default fill colors for a Flex PieChart control by setting the fills style using either CSS or MXML.</p> <p>Full code after the jump.</p> <p></p> <p>The first example shows how you can set the fills style directly in your MXML code. As you can see, you pass [...]]]></description>
			<content:encoded><![CDATA[<p>The following examples show how you can change the default fill colors for a Flex PieChart control by setting the <code>fills</code> style using either CSS or MXML.</p>
<p>Full code after the jump.</p>
<p><span id="more-282"></span></p>
<p>The first example shows how you can set the fills style directly in your MXML code. As you can see, you pass an array of SolidColor objects containing <code>color</code> and <code>alpha</code> properties. If the <code>color</code> property is not specified, the default color of black is used. If you don&#8217;t pass a value for the <code>alpha</code> property, a default value of 1.0 (fully visible) is used.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fills_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/11/changing-the-default-fill-colors-in-a-flex-piechart-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="horizontal"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:XML id="dp"&gt;
        &lt;products&gt;
            &lt;product label="Product 1" data="3" /&gt;
            &lt;product label="Product 2" data="1" /&gt;
            &lt;product label="Product 3" data="4" /&gt;
            &lt;product label="Product 4" data="1" /&gt;
            &lt;product label="Product 5" data="5" /&gt;
            &lt;product label="Product 6" data="9" /&gt;
            &lt;product label="Product 7" data="2" /&gt;
        &lt;/products&gt;
    &lt;/mx:XML&gt;

    &lt;mx:PieChart id="pieChart"
            dataProvider="{dp.product}"
            showDataTips="true"
            height="100%"
            width="100%"&gt;
        &lt;mx:series&gt;
            &lt;mx:PieSeries id="pieSeries"
                    field="@data"
                    labelPosition="callout"&gt;
                &lt;mx:fills&gt;
                       &lt;mx:SolidColor color="red" alpha="1.0" /&gt;
                       &lt;mx:SolidColor color="haloOrange" alpha="1.0" /&gt;
                       &lt;mx:SolidColor color="yellow" alpha="1.0" /&gt;
                       &lt;mx:SolidColor color="haloGreen" alpha="1.0" /&gt;
                       &lt;mx:SolidColor color="haloBlue" alpha="1.0" /&gt;
                &lt;/mx:fills&gt;
                &lt;mx:filters&gt;
                    &lt;mx:Array /&gt;
                &lt;/mx:filters&gt;
            &lt;/mx:PieSeries&gt;
        &lt;/mx:series&gt;
    &lt;/mx:PieChart&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fills_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/PieSeries_fills_test/bin/main.html" width="100%" height="300"></iframe></p>
<p>The following example shows how you can set the fills style within your style sheet (which can either be within the &lt;mx:Style /&gt; block, or loaded in from an external *.css file). When using CSS, you only specify the color value, and an alpha value of 1.0 is automatically set.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fills_test_2/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/11/changing-the-default-fill-colors-in-a-flex-piechart-control/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        PieSeries {
            fills: red, haloOrange, yellow, haloGreen, haloBlue;
        }
    &lt;/mx:Style&gt;

    &lt;mx:XML id="dp"&gt;
        &lt;products&gt;
            &lt;product label="Product 1" data="3" /&gt;
            &lt;product label="Product 2" data="1" /&gt;
            &lt;product label="Product 3" data="4" /&gt;
            &lt;product label="Product 4" data="1" /&gt;
            &lt;product label="Product 5" data="5" /&gt;
            &lt;product label="Product 6" data="9" /&gt;
            &lt;product label="Product 7" data="2" /&gt;
        &lt;/products&gt;
    &lt;/mx:XML&gt;

    &lt;mx:PieChart id="pieChart"
            dataProvider="{dp.product}"
            showDataTips="true"
            height="100%"
            width="100%"&gt;
        &lt;mx:series&gt;
            &lt;mx:PieSeries id="pieSeries"
                    field="@data"
                    labelPosition="callout"&gt;
                &lt;mx:filters&gt;
                    &lt;mx:Array /&gt;
                &lt;/mx:filters&gt;
            &lt;/mx:PieSeries&gt;
        &lt;/mx:series&gt;
    &lt;/mx:PieChart&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fills_test_2/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fills_test_2/bin/main.html" width="100%" height="300"></iframe></p>
<p><strong>Defaults? Did somebody say something about defaults?</strong><br />
If you&#8217;re curious (you probably weren&#8217;t, but hey), here are the default fill colors for the PieChart control:</p>
<p><!-- p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fills_test_2/main.mxml">View MXML</a></p -->
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fills_test_4/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fills_test_4/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Changing the default fill colors in a Flex PieChart control on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/11/changing-the-default-fill-colors-in-a-flex-piechart-control/',contentID: 'post-282',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'fills',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/2007/11/11/changing-the-default-fill-colors-in-a-flex-piechart-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating custom fills in a Flex PieChart control using the fillFunction property</title>
		<link>http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/</link>
		<comments>http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 04:16:02 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[PieSeries]]></category>
		<category><![CDATA[PieSeriesItem]]></category>
		<category><![CDATA[SolidColor]]></category>
		<category><![CDATA[fillFunction]]></category>
		<category><![CDATA[percentValue]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/</guid>
		<description><![CDATA[<p>The following example shows how you can set fill colors in a Flex PieChart by specifying a custom fill function. In this example the fill function calculates the fill color based on the percentage value of each item. The larger the wedge, the brigher the fill color.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set fill colors in a Flex PieChart by specifying a custom fill function. In this example the fill function calculates the fill color based on the percentage value of each item. The larger the wedge, the brigher the fill color.</p>
<p>Full code after the jump.</p>
<p><span id="more-283"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fillFunction_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.charts.series.items.PieSeriesItem;
            import mx.graphics.IFill;
            import mx.charts.ChartItem;
            import mx.graphics.SolidColor;

            private function pieSeries_fillFunc(item:ChartItem, index:Number):IFill {
                var curItem:PieSeriesItem = PieSeriesItem(item);
                /* Convert to a number between 0 and 1. */
                var pct:Number = curItem.percentValue / 100;
                return new SolidColor(0x0000FF * pct, 1.0);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XML id="dp"&gt;
        &lt;products&gt;
            &lt;product label="Product 1" data="3" /&gt;
            &lt;product label="Product 2" data="1" /&gt;
            &lt;product label="Product 3" data="4" /&gt;
            &lt;product label="Product 4" data="1" /&gt;
            &lt;product label="Product 5" data="5" /&gt;
            &lt;product label="Product 6" data="9" /&gt;
        &lt;/products&gt;
    &lt;/mx:XML&gt;

    &lt;mx:PieChart id="chart"
            height="100%"
            width="100%"
            showDataTips="true"
            dataProvider="{dp.product}"&gt;
        &lt;mx:series&gt;
            &lt;mx:PieSeries id="series"
                    nameField="@label"
                    field="@data"
                    fillFunction="pieSeries_fillFunc"
                    filters="[]" /&gt;
        &lt;/mx:series&gt;
    &lt;/mx:PieChart&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_fillFunction_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/PieSeries_fillFunction_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Creating custom fills in a Flex PieChart control using the fillFunction property on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/',contentID: 'post-283',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'fillFunction,percentValue',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/2007/11/07/creating-custom-fills-in-a-flex-piechart-control-using-the-fillfunction-property/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

