<?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; showDataTips</title>
	<atom:link href="http://blog.flexexamples.com/tag/showdatatips/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>Toggling data tip targets on a PieChart in Flex</title>
		<link>http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 05:19:59 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[showDataTips]]></category>
		<category><![CDATA[showDataTipTargets]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/">&#8220;Toggling data tips on a PieChart in Flex&#8221;</a>, we saw how you could toggle data tips on a Flex PieChart control by setting the showDataTips property.</p> <p>The following example shows how you can toggle data tip targets on a Flex PieChart control by setting the showDataTipTargets style.</p> <p>Full code after [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/">&#8220;Toggling data tips on a PieChart in Flex&#8221;</a>, we saw how you could toggle data tips on a Flex PieChart control by setting the <code>showDataTips</code> property.</p>
<p>The following example shows how you can toggle data tip targets on a Flex PieChart control by setting the <code>showDataTipTargets</code> style.</p>
<p>Full code after the jump.</p>
<p><span id="more-796"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTipTargets_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/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTipTargets_test"
        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;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;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="showDataTipTargets:"
                labelPlacement="left"
                selected="true" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="true"
                showDataTipTargets="{checkBox.selected}"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTipTargets_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/PieChart_showDataTipTargets_test/bin/main.html" width="100%" height="600"></iframe></p>
<p>You can also set the <code>showDataTipTargets</code> style in an external .CSS file or &lt;mx:Style /&gt; block, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTipTargets_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/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTipTargets_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        PieChart {
            showDataTipTargets: false;
        }
    &lt;/mx:Style&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&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;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="true"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you can set the <code>showDataTipTargets</code> style using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTipTargets_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/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTipTargets_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function checkBox_change(evt:Event):void {
                pieChart.setStyle("showDataTipTargets", checkBox.selected);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&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;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="showDataTipTargets:"
                labelPlacement="left"
                selected="true"
                change="checkBox_change(event);" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="true"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&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/PieChart_showDataTipTargets_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/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTipTargets_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.charts.Legend;
            import mx.charts.PieChart;
            import mx.charts.series.PieSeries;
            import mx.collections.XMLListCollection;
            import mx.containers.ApplicationControlBar;
            import mx.containers.ControlBar;
            import mx.containers.Panel;
            import mx.containers.TileDirection;
            import mx.controls.ButtonLabelPlacement;
            import mx.controls.CheckBox;

            private var dp:XMLListCollection;
            private var checkBox:CheckBox;
            private var pieChart:PieChart;
            private var pieSeries:PieSeries;

            private function init():void {
                var productsXML:XML = &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;;
                dp = new XMLListCollection(productsXML.product);

                checkBox = new CheckBox();
                checkBox.label = "showDataTipTargets:";
                checkBox.labelPlacement = ButtonLabelPlacement.LEFT;
                checkBox.selected = true;
                checkBox.addEventListener(Event.CHANGE, checkBox_change);

                var appControlBar:ApplicationControlBar;
                appControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(checkBox);
                addChildAt(appControlBar, 0);

                pieSeries = new PieSeries();
                pieSeries.field = "@data";
                pieSeries.nameField = "@label";
                pieSeries.filters = [];

                pieChart = new PieChart();
                pieChart.dataProvider = dp;
                pieChart.showDataTips = true;
                pieChart.setStyle("showDataTipTargets", true);
                pieChart.percentWidth = 100;
                pieChart.percentHeight = 100;
                pieChart.series = [pieSeries];

                var legend:Legend = new Legend();
                legend.dataProvider = pieChart;
                legend.direction = TileDirection.HORIZONTAL;
                legend.setStyle("horizontalGap", 100);
                legend.percentWidth = 100;

                var panelControlBar:ControlBar = new ControlBar();
                panelControlBar.percentWidth = 100;
                panelControlBar.addChild(legend);

                var panel:Panel = new Panel();
                panel.styleName = "opaquePanel";
                panel.percentWidth = 100;
                panel.percentHeight = 100;
                panel.addChild(pieChart);
                panel.addChild(panelControlBar);
                addChild(panel);
            }

            private function checkBox_change(evt:Event):void {
                pieChart.setStyle("showDataTipTargets", checkBox.selected);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Toggling data tip targets on a PieChart in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/',contentID: 'post-796',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'showDataTips,showDataTipTargets',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/09/13/toggling-data-tip-targets-on-a-piechart-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Toggling data tips on a PieChart in Flex</title>
		<link>http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 05:08:14 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[showDataTips]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can toggle data tips on a Flex PieChart control by setting the showDataTips property.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTips_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/ --&#62; &#60;mx:Application name="PieChart_showDataTips_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:XMLListCollection id="dp"&#62; &#60;mx:source&#62; &#60;mx:XMLList&#62; &#60;product label="Product 1" data="3" /&#62; &#60;product label="Product 2" data="1" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can toggle data tips on a Flex PieChart control by setting the <code>showDataTips</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-795"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTips_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/09/13/toggling-data-tips-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTips_test"
        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;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;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="showDataTips:"
                labelPlacement="left"
                selected="true" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                showDataTips="{checkBox.selected}"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieChart_showDataTips_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/PieChart_showDataTips_test/bin/main.html" width="100%" height="600"></iframe></p>
<div span="googleAdsLeaderboard">
<script type="text/javascript"><!--
google_ad_client = "pub-3325829455487492";
/* 728x90, created 7/15/09 */
google_ad_slot = "6403511741";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br />
</div>
<p>You can also set the <code>showDataTips</code> using ActionScript, as seen in the following example:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTips_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function checkBox_change(evt:Event):void {
                pieChart.showDataTips = checkBox.selected;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&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;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="showDataTips:"
                labelPlacement="left"
                selected="true"
                change="checkBox_change(event);" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:Panel styleName="opaquePanel"
            width="100%"
            height="100%"&gt;
        &lt;mx:PieChart id="pieChart"
                dataProvider="{dp}"
                height="100%"
                width="100%"&gt;
            &lt;mx:series&gt;
                &lt;mx:PieSeries id="pieSeries"
                        field="@data"
                        nameField="@label"
                        filters="[]" /&gt;
            &lt;/mx:series&gt;
        &lt;/mx:PieChart&gt;
        &lt;mx:ControlBar width="100%"&gt;
            &lt;mx:Legend dataProvider="{pieChart}"
                    direction="horizontal"
                    horizontalGap="100"
                    width="100%" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/ --&gt;
&lt;mx:Application name="PieChart_showDataTips_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.charts.Legend;
            import mx.charts.PieChart;
            import mx.charts.series.PieSeries;
            import mx.collections.XMLListCollection;
            import mx.containers.ApplicationControlBar;
            import mx.containers.ControlBar;
            import mx.containers.Panel;
            import mx.containers.TileDirection;
            import mx.controls.ButtonLabelPlacement;
            import mx.controls.CheckBox;

            private var dp:XMLListCollection;
            private var checkBox:CheckBox;
            private var pieChart:PieChart;
            private var pieSeries:PieSeries;

            private function init():void {
                var productsXML:XML = &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;;
                dp = new XMLListCollection(productsXML.product);

                checkBox = new CheckBox();
                checkBox.label = "showDataTips:";
                checkBox.labelPlacement = ButtonLabelPlacement.LEFT;
                checkBox.selected = true;
                checkBox.addEventListener(Event.CHANGE, checkBox_change)

                var appControlBar:ApplicationControlBar;
                appControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(checkBox);
                addChildAt(appControlBar, 0);

                pieSeries = new PieSeries();
                pieSeries.field = "@data";
                pieSeries.nameField = "@label";
                pieSeries.filters = [];

                pieChart = new PieChart();
                pieChart.dataProvider = dp;
                pieChart.showDataTips = true;
                pieChart.percentWidth = 100;
                pieChart.percentHeight = 100;
                pieChart.series = [pieSeries];

                var legend:Legend = new Legend();
                legend.dataProvider = pieChart;
                legend.direction = TileDirection.HORIZONTAL;
                legend.setStyle("horizontalGap", 100);
                legend.percentWidth = 100;

                var panelControlBar:ControlBar = new ControlBar();
                panelControlBar.percentWidth = 100;
                panelControlBar.addChild(legend);

                var panel:Panel = new Panel();
                panel.styleName = "opaquePanel";
                panel.percentWidth = 100;
                panel.percentHeight = 100;
                panel.addChild(pieChart);
                panel.addChild(panelControlBar);
                addChild(panel);
            }

            private function checkBox_change(evt:Event):void {
                pieChart.showDataTips = checkBox.selected;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Toggling data tips on a PieChart in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/09/13/toggling-data-tips-on-a-piechart-in-flex/',contentID: 'post-795',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'showDataTips',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/09/13/toggling-data-tips-on-a-piechart-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating clustered, stacked, overlaid, and 100% Bar charts in Flex 3</title>
		<link>http://blog.flexexamples.com/2007/10/11/creating-clustered-stacked-overlaid-and-100-bar-charts-in-flex-3/</link>
		<comments>http://blog.flexexamples.com/2007/10/11/creating-clustered-stacked-overlaid-and-100-bar-charts-in-flex-3/#comments</comments>
		<pubDate>Fri, 12 Oct 2007 06:19:03 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[BarChart]]></category>
		<category><![CDATA[Charting]]></category>
		<category><![CDATA[clustered]]></category>
		<category><![CDATA[overlaid]]></category>
		<category><![CDATA[showAllDataTips]]></category>
		<category><![CDATA[showDataTips]]></category>
		<category><![CDATA[stacked]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/10/11/creating-clustered-stacked-overlaid-and-100-bar-charts-in-flex-3/</guid>
		<description><![CDATA[<p>The following example shows the differences between a clustered, stacked, 100%, and overlaid Bar chart in Flex 3.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/BarChart_type_test/main.mxml">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2007/10/11/creating-clustered-stacked-overlaid-and-100-bar-charts-in-flex-3/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:ApplicationControlBar dock="true"&#62; &#60;mx:Form&#62; &#60;mx:FormItem label="type:"&#62; &#60;mx:ComboBox id="comboBox"&#62; &#60;mx:dataProvider&#62; &#60;mx:Object label="clustered" /&#62; &#60;mx:Object label="stacked" /&#62; &#60;mx:Object label="100%" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows the differences between a clustered, stacked, 100%, and overlaid Bar chart in Flex 3.</p>
<p>Full code after the jump.</p>
<p><span id="more-229"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/BarChart_type_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/10/11/creating-clustered-stacked-overlaid-and-100-bar-charts-in-flex-3/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form&gt;
            &lt;mx:FormItem label="type:"&gt;
                &lt;mx:ComboBox id="comboBox"&gt;
                    &lt;mx:dataProvider&gt;
                        &lt;mx:Object label="clustered" /&gt;
                        &lt;mx:Object label="stacked" /&gt;
                        &lt;mx:Object label="100%" /&gt;
                        &lt;mx:Object label="overlaid" /&gt;
                    &lt;/mx:dataProvider&gt;
                &lt;/mx:ComboBox&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="showDataTips:"&gt;
                &lt;mx:CheckBox id="checkBox1" /&gt;
            &lt;/mx:FormItem&gt;
            &lt;mx:FormItem label="showAllDataTips:"&gt;
                &lt;mx:CheckBox id="checkBox2" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;

        &lt;mx:Spacer width="100%" /&gt;

        &lt;mx:Legend dataProvider="{barChart}"/&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:BarChart id="barChart"
            type="{comboBox.selectedItem.label}"
            showDataTips="{checkBox1.selected}"
            showAllDataTips="{checkBox2.selected}"
            height="100%"
            width="100%"&gt;

        &lt;mx:dataProvider&gt;
            &lt;mx:Array&gt;
                &lt;mx:Object name="R Winn" obp=".353" slg=".445" avg=".300" /&gt;
                &lt;mx:Object name="P Feliz" obp=".290" slg=".418" avg=".253" /&gt;
                &lt;mx:Object name="O Vizquel" obp=".305" slg=".316" avg=".246" /&gt;
                &lt;mx:Object name="B Molina" obp=".298" slg=".433" avg=".276" /&gt;
                &lt;mx:Object name="R Durham" obp=".295" slg=".343" avg=".218" /&gt;
            &lt;/mx:Array&gt;
        &lt;/mx:dataProvider&gt;

        &lt;mx:verticalAxis&gt;
            &lt;mx:CategoryAxis categoryField="name"/&gt;
        &lt;/mx:verticalAxis&gt;

        &lt;mx:series&gt;
            &lt;mx:BarSeries yField="name" xField="obp" displayName="OBP"/&gt;
            &lt;mx:BarSeries yField="name" xField="slg" displayName="SLG"/&gt;
            &lt;mx:BarSeries yField="name" xField="avg" displayName="AVG"/&gt;
        &lt;/mx:series&gt;
    &lt;/mx:BarChart&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/BarChart_type_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/BarChart_type_test/bin/main.html" width="100%" height="600"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Creating clustered, stacked, overlaid, and 100% Bar charts in Flex 3 on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/10/11/creating-clustered-stacked-overlaid-and-100-bar-charts-in-flex-3/',contentID: 'post-229',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'clustered,overlaid,showAllDataTips,showDataTips,stacked',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/10/11/creating-clustered-stacked-overlaid-and-100-bar-charts-in-flex-3/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Sorting date columns in a DataGrid</title>
		<link>http://blog.flexexamples.com/2007/08/12/sorting-date-columns-in-a-datagrid/</link>
		<comments>http://blog.flexexamples.com/2007/08/12/sorting-date-columns-in-a-datagrid/#comments</comments>
		<pubDate>Sun, 12 Aug 2007 15:51:01 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[DataGrid]]></category>
		<category><![CDATA[ObjectUtil]]></category>
		<category><![CDATA[dataTipFunction]]></category>
		<category><![CDATA[dateCompare()]]></category>
		<category><![CDATA[showDataTips]]></category>
		<category><![CDATA[sortCompareFunction]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/12/sorting-date-columns-in-a-datagrid/</guid>
		<description><![CDATA[<p>Here&#8217;s an example of sorting a column of dates in a Flex DataGrid. The dates start out as Strings (such as &#8220;04/14/1980&#8243;) so you create a custom sortCompareFunction on that DataGrid column which converts the strings to dates so Flex will sort the dates in sequential order (as oppsed to string order). Hope that helps [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an example of sorting a column of dates in a Flex DataGrid. The dates start out as Strings (such as &#8220;04/14/1980&#8243;) so you create a custom <code>sortCompareFunction</code> on that DataGrid column which converts the strings to dates so Flex will sort the dates in sequential order (as oppsed to string order). Hope that helps somebody out there.</p>
<p>I also created a little tooltip on the date column which shows the dates in a somewhat more readable form (&#8220;April 14 1980&#8243;) using the DataGridColumn object&#8217;s <code>showDataTips</code> and <code>dataTipFunction</code> properties.</p>
<p>Full code after the jump.</p>
<p><span id="more-81"></span></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/2007/08/12/sorting-date-columns-in-a-datagrid/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.utils.ObjectUtil;</span>
&nbsp;
<span style="color: #339933;">            private function date_sortCompareFunc(itemA:Object, itemB:Object):int {</span>
<span style="color: #339933;">                /* Date.parse() returns an int, but</span>
<span style="color: #339933;">                   ObjectUtil.dateCompare() expects two</span>
<span style="color: #339933;">                   Date objects, so convert String to</span>
<span style="color: #339933;">                   int to Date. */</span>
<span style="color: #339933;">                var dateA:Date = new Date(Date.parse(itemA.dob));</span>
<span style="color: #339933;">                var dateB:Date = new Date(Date.parse(itemB.dob));</span>
<span style="color: #339933;">                return ObjectUtil.dateCompare(dateA, dateB);</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function date_dataTipFunc(item:Object):String {</span>
<span style="color: #339933;">                return dateFormatter.format(item.dob);</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ArrayCollection</span> id=<span style="color: #ff0000;">&quot;arrColl&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:source</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Array</span><span style="color: #7400FF;">&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> name=<span style="color: #ff0000;">&quot;User A&quot;</span> dob=<span style="color: #ff0000;">&quot;04/14/1980&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> name=<span style="color: #ff0000;">&quot;User B&quot;</span> dob=<span style="color: #ff0000;">&quot;01/02/1975&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> name=<span style="color: #ff0000;">&quot;User C&quot;</span> dob=<span style="color: #ff0000;">&quot;12/30/1977&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
                <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Object</span> name=<span style="color: #ff0000;">&quot;User D&quot;</span> dob=<span style="color: #ff0000;">&quot;10/27/1968&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Array</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:source</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ArrayCollection</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DateFormatter</span> id=<span style="color: #ff0000;">&quot;dateFormatter&quot;</span> formatString=<span style="color: #ff0000;">&quot;MMMM D, YYYY&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGrid</span> id=<span style="color: #ff0000;">&quot;dataGrid&quot;</span> dataProvider=<span style="color: #ff0000;">&quot;{arrColl}&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:columns</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGridColumn</span> dataField=<span style="color: #ff0000;">&quot;name&quot;</span></span>
<span style="color: #000000;">                    headerText=<span style="color: #ff0000;">&quot;Name:&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGridColumn</span> dataField=<span style="color: #ff0000;">&quot;dob&quot;</span></span>
<span style="color: #000000;">                    headerText=<span style="color: #ff0000;">&quot;Date of birth:&quot;</span></span>
<span style="color: #000000;">                    sortCompareFunction=<span style="color: #ff0000;">&quot;date_sortCompareFunc&quot;</span></span>
<span style="color: #000000;">                    showDataTips=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                    dataTipFunction=<span style="color: #ff0000;">&quot;date_dataTipFunc&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:columns</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:DataGrid</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/DataGrid_date_sort_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/DataGrid_date_sort_test/bin/main.html" width="100%" height="220"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Sorting date columns in a DataGrid on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/08/12/sorting-date-columns-in-a-datagrid/',contentID: 'post-81',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'dataTipFunction,dateCompare(),showDataTips,sortCompareFunction',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/08/12/sorting-date-columns-in-a-datagrid/feed/</wfw:commentRss>
		<slash:comments>38</slash:comments>
		</item>
		<item>
		<title>Downloading files in Flex using the FileReference class</title>
		<link>http://blog.flexexamples.com/2007/07/28/downloading-files-in-flex-using-the-filereference-class/</link>
		<comments>http://blog.flexexamples.com/2007/07/28/downloading-files-in-flex-using-the-filereference-class/#comments</comments>
		<pubDate>Sat, 28 Jul 2007 17:20:53 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[FileReference]]></category>
		<category><![CDATA[dataTipField]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[showDataTips]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/07/28/downloading-files-in-flex-using-the-filereference-class/</guid>
		<description><![CDATA[<p>OK, enough embedding examples, lets take a look at downloading files using Flash Player&#8217;s FileReference class (flash.net.FileReference). This example demonstrates a basic usage of the FileReference class within Flex, allowing users to download a file from the server. This example also shows how you can use data tips in the DataGrid control by setting the [...]]]></description>
			<content:encoded><![CDATA[<p>OK, enough embedding examples, lets take a look at downloading files using Flash Player&#8217;s FileReference class (flash.net.FileReference). This example demonstrates a basic usage of the FileReference class within Flex, allowing users to download a file from the server. This example also shows how you can use data tips in the DataGrid control by setting the data grid column&#8217;s <code>showDataTips</code> property to <code>true</code> and specifying a value for the <code>dataTipField</code> column.</p>
<p>Full code after the jump.</p>
<p><span id="more-35"></span></p>
<p>The following example downloads a ZIP file when the user presses the Button control. You can mouse over the items in the DataGrid control&#8217;s &#8220;Type&#8221; column to see additional event information.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/FileReference_download_test/bin/srcview/FileReference_download_test.zip">Download source (ZIP, 3K)</a> | <a href="/wp-content/uploads/FileReference_download_test/main.mxml">View MXML</a></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/2007/07/28/downloading-files-in-flex-using-the-filereference-class/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span></span>
<span style="color: #000000;">        creationComplete=<span style="color: #ff0000;">&quot;init();&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.controls.Alert;</span>
<span style="color: #339933;">            import mx.collections.ArrayCollection;</span>
<span style="color: #339933;">            import flash.net.FileReference;</span>
&nbsp;
<span style="color: #339933;">            [Bindable]</span>
<span style="color: #339933;">            [Embed('assets/disk.png')]</span>
<span style="color: #339933;">            private var diskIcon:Class;</span>
&nbsp;
<span style="color: #339933;">            [Bindable]</span>
<span style="color: #339933;">            private var arrColl:ArrayCollection;</span>
&nbsp;
<span style="color: #339933;">            /* URL of the file to download. */</span>
<span style="color: #339933;">            private const FILE_URL:String = &quot;http://blog.flexexamples.com/wp-content/uploads/FileReference_download_test/bin/srcview/FileReference_download_test.zip&quot;;</span>
&nbsp;
<span style="color: #339933;">            private var fileRef:FileReference;</span>
<span style="color: #339933;">            private var urlReq:URLRequest;</span>
&nbsp;
<span style="color: #339933;">            private function init():void {</span>
<span style="color: #339933;">                /* Initialize the array collection to an empty collection. */</span>
<span style="color: #339933;">                arrColl = new ArrayCollection();</span>
&nbsp;
<span style="color: #339933;">                /* Set up the URL request to download the file specified by the FILE_URL variable. */</span>
<span style="color: #339933;">                urlReq = new URLRequest(FILE_URL);</span>
&nbsp;
<span style="color: #339933;">                /* Define file reference object and add a bunch of event listeners. */</span>
<span style="color: #339933;">                fileRef = new FileReference();</span>
<span style="color: #339933;">                fileRef.addEventListener(Event.CANCEL, doEvent);</span>
<span style="color: #339933;">                fileRef.addEventListener(Event.COMPLETE, doEvent);</span>
<span style="color: #339933;">                fileRef.addEventListener(Event.OPEN, doEvent);</span>
<span style="color: #339933;">                fileRef.addEventListener(Event.SELECT, doEvent);</span>
<span style="color: #339933;">                fileRef.addEventListener(HTTPStatusEvent.HTTP_STATUS, doEvent);</span>
<span style="color: #339933;">                fileRef.addEventListener(IOErrorEvent.IO_ERROR, doEvent);</span>
<span style="color: #339933;">                fileRef.addEventListener(ProgressEvent.PROGRESS, doEvent);</span>
<span style="color: #339933;">                fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR, doEvent);</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function doEvent(evt:Event):void {</span>
<span style="color: #339933;">                /* Create shortcut to the FileReference object. */</span>
<span style="color: #339933;">                var fr:FileReference = evt.currentTarget as FileReference;</span>
&nbsp;
<span style="color: #339933;">                /* Add event order and type to the DataGrid control. */</span>
<span style="color: #339933;">                arrColl.addItem({data:arrColl.length+1, type:evt.type, eventString:evt.toString()});</span>
&nbsp;
<span style="color: #339933;">                try {</span>
<span style="color: #339933;">                    /* Update the Model. */</span>
<span style="color: #339933;">                    fileRefModel.creationDate = fr.creationDate;</span>
<span style="color: #339933;">                    fileRefModel.creator = fr.creator;</span>
<span style="color: #339933;">                    fileRefModel.modificationDate = fr.modificationDate;</span>
<span style="color: #339933;">                    fileRefModel.name = fr.name;</span>
<span style="color: #339933;">                    fileRefModel.size = fr.size;</span>
<span style="color: #339933;">                    fileRefModel.type = fr.type;</span>
<span style="color: #339933;">                    /* Display the Text control. */</span>
<span style="color: #339933;">                    txt.visible = true;</span>
<span style="color: #339933;">                } catch (err:*) {</span>
<span style="color: #339933;">                    /* uh oh, an error of sorts. */</span>
<span style="color: #339933;">                }</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function downloadSourceCodeZip():void {</span>
<span style="color: #339933;">                /* Clear existing array collection. */</span>
<span style="color: #339933;">                arrColl = new ArrayCollection();</span>
<span style="color: #339933;">                /* Hide the Text control. */</span>
<span style="color: #339933;">                txt.visible = false;</span>
<span style="color: #339933;">                /* Begin download. */</span>
<span style="color: #339933;">                fileRef.download(urlReq);</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function showAlert(item:Object):void {</span>
<span style="color: #339933;">                Alert.show(item.eventString, item.type);</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Model</span> id=<span style="color: #ff0000;">&quot;fileRefModel&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;file<span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;">&lt;creationDate<span style="color: #7400FF;">&gt;</span></span>{&quot;&quot;}<span style="color: #000000;">&lt;/creationDate<span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;">&lt;creator<span style="color: #7400FF;">&gt;</span></span>{&quot;&quot;}<span style="color: #000000;">&lt;/creator<span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;">&lt;modificationDate<span style="color: #7400FF;">&gt;</span></span>{&quot;&quot;}<span style="color: #000000;">&lt;/modificationDate<span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;">&lt;name<span style="color: #7400FF;">&gt;</span></span>{&quot;&quot;}<span style="color: #000000;">&lt;/name<span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;">&lt;size<span style="color: #7400FF;">&gt;</span></span>{&quot;&quot;}<span style="color: #000000;">&lt;/size<span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;">&lt;type<span style="color: #7400FF;">&gt;</span></span>{&quot;&quot;}<span style="color: #000000;">&lt;/type<span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;/file<span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Model</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> id=<span style="color: #ff0000;">&quot;downloadBtn&quot;</span></span>
<span style="color: #000000;">            label=<span style="color: #ff0000;">&quot;Download example source code&quot;</span></span>
<span style="color: #000000;">            icon=<span style="color: #ff0000;">&quot;{diskIcon}&quot;</span></span>
<span style="color: #000000;">            click=<span style="color: #ff0000;">&quot;downloadSourceCodeZip();&quot;</span></span>
<span style="color: #000000;">            toolTip=<span style="color: #ff0000;">&quot;{FILE_URL}&quot;</span></span>
<span style="color: #000000;">            height=<span style="color: #ff0000;">&quot;40&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGrid</span> id=<span style="color: #ff0000;">&quot;debug&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;{arrColl}&quot;</span></span>
<span style="color: #000000;">            width=<span style="color: #ff0000;">&quot;{downloadBtn.width}&quot;</span></span>
<span style="color: #000000;">            rowCount=<span style="color: #ff0000;">&quot;5&quot;</span></span>
<span style="color: #000000;">            rowHeight=<span style="color: #ff0000;">&quot;22&quot;</span></span>
<span style="color: #000000;">            itemClick=<span style="color: #ff0000;">&quot;showAlert(event.currentTarget.selectedItem)&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:columns</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGridColumn</span> dataField=<span style="color: #ff0000;">&quot;data&quot;</span></span>
<span style="color: #000000;">                    headerText=<span style="color: #ff0000;">&quot;#&quot;</span></span>
<span style="color: #000000;">                    width=<span style="color: #ff0000;">&quot;20&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGridColumn</span> dataField=<span style="color: #ff0000;">&quot;type&quot;</span></span>
<span style="color: #000000;">                    headerText=<span style="color: #ff0000;">&quot;Type&quot;</span></span>
<span style="color: #000000;">                    showDataTips=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #000000;">                    dataTipField=<span style="color: #ff0000;">&quot;eventString&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:columns</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:DataGrid</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Text</span> id=<span style="color: #ff0000;">&quot;txt&quot;</span> condenseWhite=<span style="color: #ff0000;">&quot;true&quot;</span> visible=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:text</span><span style="color: #7400FF;">&gt;</span></span>
            creationDate: {fileRefModel.creationDate}
            creator: {fileRefModel.creator}
            modificationDate: {fileRefModel.modificationDate}
            name: {fileRefModel.name}
            size: {fileRefModel.size}
            type: {fileRefModel.type}
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:text</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Text</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p class="information">View source enabled in the following example.</p>
<p><iframe height="400" width="100%" src="http://blog.flexexamples.com/wp-content/uploads/FileReference_download_test/bin/main.html"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Downloading files in Flex using the FileReference class on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/07/28/downloading-files-in-flex-using-the-filereference-class/',contentID: 'post-35',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'dataTipField,download,showDataTips',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/07/28/downloading-files-in-flex-using-the-filereference-class/feed/</wfw:commentRss>
		<slash:comments>57</slash:comments>
		</item>
	</channel>
</rss>

