<?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>manewc &#187; Flex Web Development</title>
	<atom:link href="http://manewc.com/category/flex-web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://manewc.com</link>
	<description>iPhone, Flash, Flex, AIR, &#38; Web Development</description>
	<lastBuildDate>Sat, 31 Oct 2009 16:47:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Downloading Multiple Files with Flex 3 and AMFPHP</title>
		<link>http://manewc.com/2008/12/22/downloading-multiple-files-with-flex-3/</link>
		<comments>http://manewc.com/2008/12/22/downloading-multiple-files-with-flex-3/#comments</comments>
		<pubDate>Mon, 22 Dec 2008 16:44:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AMFPHP]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flex Web Development]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=254</guid>
		<description><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Main_1077105237"
			class="flashmovie"
			width="700"
			height="540">
	<param name="movie" value="/projects/flex3/MultipleFileDownloadAMFPHP/Main.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/MultipleFileDownloadAMFPHP/Main.swf"
			name="fm_Main_1077105237"
			width="700"
			height="540">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
I originally was thinking that I would be able to do this by having the user select the files of their choice and click one button to download the items. So depending on their selection the Flex app would download the first item, then upon complete download of the first item [...]]]></description>
			<content:encoded><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Main_1117482306"
			class="flashmovie"
			width="700"
			height="540">
	<param name="movie" value="/projects/flex3/MultipleFileDownloadAMFPHP/Main.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/MultipleFileDownloadAMFPHP/Main.swf"
			name="fm_Main_1117482306"
			width="700"
			height="540">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>I originally was thinking that I would be able to do this by having the user select the files of their choice and click one button to download the items. So depending on their selection the Flex app would download the first item, then upon complete download of the first item it would download the second item and so on.. Unfortunately I could not get this to work on various browsers as the dialog box to download the file location would never appear on the second file. So with a little exploring I was able to accomplish the task of downloading multiple files of the users choosing with the use of:</p>
<p>Here is a list of things that I needed to get this working.</p>
<ol>
<li><a href="http://www.amfphp.org">AMFPHP</a> &#8211; Lee Brimelow has an excellent tutorial to get you started: <a href="http://www.gotoandlearn.com/play?id=78">http://www.gotoandlearn.com/play?id=78</a></li>
<li>PHP Class file to create zip documents from an array. You can find the one I used here: <a href="http://www.phpconcept.net/pclzip/index.en.php">http://www.phpconcept.net/pclzip/index.en.php</a> (note I am using PHP 5.*)</li>
<li>I also grabbed this class file from <a href="http://www.flexexamples.com">FlexExamples.com</a> for <a href="http://blog.flexexamples.com/2008/01/27/using-a-checkbox-control-as-a-list-item-renderer-in-flex/">using a checkbox control as a list item renderer</a></li>
</ol>
<p>Here is the process:</p>
<ol>
<li>So first the user will select the files he/she wishes to download</li>
<li>The user will need to click a button to notify the server the array of files and generate a unique .zip document</li>
<li>The download button will need to be active once the zip file is created so the user can then download the new .zip file</li>
<li>User clicks the download button to download the file</li>
<li>Will need to run a cron to delete all the generated .zip files as to not load up my server. (I won&#8217;t cover this step)</li>
</ol>
<p>Honestly I am not a PHP programmer, but this is the Service Class that I put in my Service folder in my AMFPHP setup&#8230;</p>
<p>The file name is ZipFile.php (also don&#8217;t forget to inlude the library for zipping files)</p>
<pre name="code" class="c-sharp">
&lt;?php

class ZipFile
{
	/**
	* Demo ZipFile
	* @returns file name of zip object
	*/

	function ZipFileTest($fileArr) // this is what gets called from flash
	{
		// include the library from http://www.phpconcept.net/pclzip/index.en.php
		include_once("pclzip.lib.php");

		// create a unique file name.. this is prepended with manewc.com-
		$uniqueFileName = uniqid("manewc.com-");

		// create the zip
		$archive = new PclZip('../relative/path/to/put/this/zip/file'.$uniqueFileName.'.zip');

		$v_list = $archive->create($fileArr);

  		if ($v_list == 0) {
    		$status = "Error : ".$archive->errorInfo(true);
  		}
  		else
  		{
  			$status = $uniqueFileName;
  		}

		return $status;

	}
}

?$gt;
</pre>
<p>In Flex, I just need to add the ListItemValueObject.as file from <a href="http://blog.flexexamples.com/2008/01/27/using-a-checkbox-control-as-a-list-item-renderer-in-flex/">FlexExamples.com</a>. I added this file in src/com/flexexamples/.</p>
<p>Here is my Main.mxml file to create the ui:</p>
<p><strong>Please note that my editor generally does not render my flex code properly.. check this file here: <a href="http://manewc.com/projects/flex3/MultipleFileDownloadAMFPHP/Main.mxml.txt">Main.mxml.txt</a></strong></p>
<pre name="code" class="c-sharp">
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:vo="com.flexexamples.*"
    layout="absolute"
    creationComplete="init()">

    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import flash.net.FileReference;
            import com.flexexamples.*;

            import mx.events.CollectionEvent;
            import mx.utils.ObjectUtil;

            private var phpArr:String = "";
            private var tArr:Array;

            public var DOWNLOAD_URL:String;
            public var _fr:FileReference = new FileReference();
            // private var _dlFileName:String;

            private function init():void {
                arrColl.dispatchEvent(new CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
            }

            private function arrColl_collectionChange(evt:CollectionEvent):void {
                try {
                    tArr = arrColl.source.filter(selectedOnly);
                    textArea.text = ObjectUtil.toString(tArr);
                    lbl.text = tArr.length.toString() + " item(s) selected";
                } catch (err:Error) {
                    // ignore.
                }
            }

            private function selectedOnly(item:ListItemValueObject, idx:uint, arr:Array):Boolean {
                return item.isSelected;
            }

            private function amfphp():void
            {
                // create the array of files:
                // var filesToDL:Array = new Array("../../projects/flex3/FileDownloadMultiple/life-1.jpg","../../projects/flex3/FileDownloadMultiple/life-2.jpg");

                var filesToDL:Array = new Array();
                for ( var k:int=0; k < tArr.length; k++ )
                {
                    filesToDL[k] = tArr[k].fileLocation;
                }

                // mx.controls.Alert.show ( "Item: " + filesToDL );

                // reconfigure Array so PHP can interpret
                phpArr = "";
                for ( var u:int=0; u < filesToDL.length; u++ )
                {
                    phpArr += filesToDL[u];

                    if ( u < filesToDL.length - 1 )
                    {
                        phpArr += ",";
                    }
                }

                txtOutput.htmlText = "Waiting for status...\n" + phpArr + " (" + filesToDL.length + " items)\n";

                //connect
                var gw:NetConnection = new NetConnection();
                gw.connect( "../../../amfphp/gateway.php" );

                // 2 functions called when data is passed back..
                // one for success, one for failure
                var res:Responder = new Responder ( onResult, onFault );

                // the php method, the result, parameters
                gw.call ( "ZipFile.ZipFileTest", res, phpArr);

            }

            private function onResult ( responds:Object ):void
            {
                txtOutput.htmlText = "File to download: " + responds;

                // file to download name:
                DOWNLOAD_URL = responds as String;

                // all set, now activate the download file button
                btnDownload.enabled = true;
            }

            private function onFault ( responds:Object):void
            {
                for ( var i in responds )
                {
                    txtOutput.htmlText = "Error: " + responds[i];
                }
            }

            private function downloadFile():void
            {
                // disable the download button
                btnDownload.enabled = false;

                // mx.controls.Alert.show( "test" + DOWNLOAD_URL );
                _fr = new FileReference;
                _fr.addEventListener(Event.OPEN, openHandler);
                _fr.addEventListener(ProgressEvent.PROGRESS, progressHandler);
                _fr.addEventListener(Event.COMPLETE, completeHandler);

                // DOWNLOAD_URL = "http://manewc.com/projects/download/archive.zip";
                if ( DOWNLOAD_URL != "" )
                {
                    // DOWNLOAD_URL = "";
                }

                DOWNLOAD_URL = "../../download/" + DOWNLOAD_URL + ".zip";
                 txtOutput.htmlText = "DLURL: " + DOWNLOAD_URL;

                var request:URLRequest = new URLRequest();
                request.url = DOWNLOAD_URL;
                _fr.download(request);
            }

            /**
         * When the OPEN event has dispatched, change the progress bar's label
         * and enable the "Cancel" button, which allows the user to abort the
         * download operation.
         */
        private function openHandler(event:Event):void {
            pb.label = "DOWNLOADING %3%%";
            txtOutput.htmlText = "DOWNLOADING %3%%";
        }

        /**
         * While the file is downloading, update the progress bar's status and label.
         */
        private function progressHandler(event:ProgressEvent):void {
            pb.setProgress(event.bytesLoaded, event.bytesTotal);
            txtOutput.htmlText = "DOWNLOADING... " + (event.bytesLoaded/event.bytesTotal) + "%";
        }

        /**
         * Once the download has completed, change the progress bar's label and
         * disable the "Cancel" button since the download is already completed.
         */
        private function completeHandler(event:Event):void {
            // loadedStatus = true;
               pb.label = "DOWNLOAD COMPLETE";
            pb.setProgress(0, 100);
            //btn.enabled = false;
            txtOutput.htmlText = "DOWNLOADING... COMPLETE"

        }
        ]]&gt;
    </mx:Script>
    <mx:Text id="txtOutput" x="261.5" y="40" width="366.5"/>
    <mx:Button x="261.5" y="10" label="Download File" click="downloadFile()" enabled="false" id="btnDownload"/>

    <mx:Panel title="Download File Progress" paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10" x="261.5" y="68">
    <mx:ProgressBar id="pb" label="progress" mode="manual" />
    </mx:Panel>

    <mx:Array id="arr">
        <vo:ListItemValueObject label="Flash Files" isSelected="true" fileLocation="../../projects/flash/PapervisionCubeSides/PapervisionCubeSides.zip" />
        <vo:ListItemValueObject label="Image One" isSelected="true" fileLocation="../../projects/flex3/FileDownloadMultiple/life-1.jpg" />
        <vo:ListItemValueObject label="Image Two" isSelected="true" fileLocation="../../projects/flex3/FileDownloadMultiple/life-2.jpg" />
    </mx:Array>

    <mx:ArrayCollection id="arrColl"
            source="{arr}"
            collectionChange="arrColl_collectionChange(event);" />

    <mx:Panel id="panel"
            title="Items"
            status="{arrColl.length} total"
            styleName="opaquePanel" x="10" y="10">
        <mx:List id="list"
                dataProvider="{arrColl}"
                alternatingItemColors="[#cccccc, #ffffff]"
                width="150"
                rowCount="8">
            <mx:itemRenderer>
                <mx:Component>
                    <mx:CheckBox selectedField="isSelected"
                            change="onChange(event);">
                        <mx:Script>
                            <![CDATA[
                                private function onChange(evt:Event):void {
                                    data.isSelected = !data.isSelected;
                                }
                            ]]&gt;
                        </mx:Script>
                    </mx:CheckBox>
                </mx:Component>
            </mx:itemRenderer>
        </mx:List>
        <mx:Label id="lbl" />
        <mx:ControlBar horizontalAlign="right" height="40">
            <mx:Button id="btnRun" label="Zip Files" click="amfphp()"/>
        </mx:ControlBar>
    </mx:Panel>

    <mx:TextArea id="textArea"
            verticalScrollPolicy="on"
            width="366.5"
            height="{panel.height}"  x="261.5" y="177"/>

</mx:Application>
</pre>
<p>I&#8217;ll have to admit that this code needs to be cleaned up.. just ran out of time at the moment.</p>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/12/22/downloading-multiple-files-with-flex-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Craigslist RSS Reader with ItemRenderer</title>
		<link>http://manewc.com/2008/11/25/craigslist-rss-reader-with-itemrenderer/</link>
		<comments>http://manewc.com/2008/11/25/craigslist-rss-reader-with-itemrenderer/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 18:24:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex Web Development]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=230</guid>
		<description><![CDATA[So, I simply wanted to learn more about the itemRenderer property of the List component and made a little .swf that will read different Craigslist.com RSS feeds. (crossdomain.xml issues will not allow this movie to work, but will from your desktop when published)

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_CraigsListReaderFlex_1021260261"
			class="flashmovie"
			width="700"
			height="700">
	<param name="movie" value="/projects/flex3/CraigsListReaderFlex/CraigsListReaderFlex.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/CraigsListReaderFlex/CraigsListReaderFlex.swf"
			name="fm_CraigsListReaderFlex_1021260261"
			width="700"
			height="700">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
Within my Flex Project I have the following 2 [...]]]></description>
			<content:encoded><![CDATA[<p>So, I simply wanted to learn more about the itemRenderer property of the List component and made a little .swf that will read different Craigslist.com RSS feeds. (crossdomain.xml issues will not allow this movie to work, but will from your desktop when published)</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_CraigsListReaderFlex_509064512"
			class="flashmovie"
			width="700"
			height="700">
	<param name="movie" value="/projects/flex3/CraigsListReaderFlex/CraigsListReaderFlex.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/CraigsListReaderFlex/CraigsListReaderFlex.swf"
			name="fm_CraigsListReaderFlex_509064512"
			width="700"
			height="700">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Within my Flex Project I have the following 2 files within my &#8217;src&#8217; folder. </p>
<p>The main file called: CragsListReaderFlex.mxml:</p>
<pre name="code" class="c-sharp">
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
	<mx:Script>
		<![CDATA[
			import mx.rpc.events.ResultEvent;
			import mx.rpc.events.FaultEvent;
            import mx.controls.Alert;

			private function renderRSS ():void
			{
				clRSS.url = rssCombo.selectedItem.valueOf();
				clRSS.send();
			}

			private function httpService_Fault(evt:FaultEvent):void {
                var title:String = evt.type + " (" + evt.fault.faultCode + ")";
                var text:String = evt.fault.faultString;
                pageStatus.htmlText = title + "" + text;
            }

            private function httpService_Result(evt:ResultEvent):void {
                pageStatus.htmlText = "Done: " + evt.result;
            }
		]]&gt;
	</mx:Script>

	<mx:HTTPService id="clRSS"
		fault="httpService_Fault(event)"
		result="httpService_Result(event)"
		/>

	<mx:ComboBox x="5" y="4" width="300" id="rssCombo">
		<mx:dataProvider>
                  <mx:Array>
                     <mx:String></mx:String>
                     <mx:String>http://burlington.craigslist.org/rea/index.rss</mx:String>
                     <mx:String>http://burlington.craigslist.org/sys/index.rss</mx:String>
                   </mx:Array>
		</mx:dataProvider>
	</mx:ComboBox>
	<mx:Button click="renderRSS()" cornerRadius="10" label="Render RSS" x="337" y="4" />

	<mx:Text id="pageStatus" x="400" y="4" width="100%" textAlign="right" text="Status"/>

	<mx:List id="clList" itemRenderer="CLListView" dataProvider="{clRSS.lastResult.RDF.item}" width="100%" height="100%" y="30">
	</mx:List>
</mx:Application>
</pre>
<p>and my itemRenderer called: CLListView.mxml:</p>
<pre name="code" class="c-sharp">
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100">
	<mx:Text text="{data.title}" height="20" y="0" />
	<mx:Text text="{data.date}" height="20" y="20" />
	<mx:Text htmlText="{data.description}" height="100%" y="40"  />
</mx:Canvas>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/11/25/craigslist-rss-reader-with-itemrenderer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex 3 Application Control Bar</title>
		<link>http://manewc.com/2008/10/24/flex-3-application-control-bar/</link>
		<comments>http://manewc.com/2008/10/24/flex-3-application-control-bar/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 18:02:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex Web Development]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=222</guid>
		<description><![CDATA[Simple demo of the ApplicationControlBar with check and radio marks on active submenu items.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ApplicationControlBar_1060371333"
			class="flashmovie"
			width="700"
			height="260">
	<param name="movie" value="/projects/flex3/ApplicationControlBar/ApplicationControlBar.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/ApplicationControlBar/ApplicationControlBar.swf"
			name="fm_ApplicationControlBar_1060371333"
			width="700"
			height="260">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>



    
        
            
              [...]]]></description>
			<content:encoded><![CDATA[<p>Simple demo of the ApplicationControlBar with check and radio marks on active submenu items.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ApplicationControlBar_1392924592"
			class="flashmovie"
			width="700"
			height="260">
	<param name="movie" value="/projects/flex3/ApplicationControlBar/ApplicationControlBar.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/ApplicationControlBar/ApplicationControlBar.swf"
			name="fm_ApplicationControlBar_1392924592"
			width="700"
			height="260">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<pre name="code" class="c-sharp">
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="0xffffff">
    <mx:ApplicationControlBar dock="true" paddingTop="0" paddingBottom="0">
        <mx:MenuBar id="myMenuBar" labelField="@label">
            <mx:XMLList>
                <menuitem label="Menu A" >
                    <menuitem label="SubMenu A1" type="check"/>
                    <menuitem label="SubMenu A2" type="check"/>
                </menuitem>
                <menuitem label="Menu B"/>
                <menuitem label="Menu C" >
                    <menuitem label="SubMenu C1" type="radio" groupName="smgroup"/>
                    <menuitem label="SubMenu C2" type="radio" groupName="smgroup"/>
                    <menuitem label="SubMenu C3" type="radio" groupName="smgroup"/>
                </menuitem>
            </mx:XMLList>
        </mx:MenuBar>
    </mx:ApplicationControlBar>
</mx:Application>
</pre>
<p>.. and corrected:</p>
<p>&lt;?xml version=&quot;1.0&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; backgroundColor=&quot;0xffffff&quot;&gt;<br />
&lt;mx:ApplicationControlBar dock=&quot;true&quot; paddingTop=&quot;0&quot; paddingBottom=&quot;0&quot;&gt;<br />
&lt;mx:MenuBar id=&quot;myMenuBar&quot; labelField=&quot;@label&quot;&gt;<br />
&lt;mx:XMLList&gt;<br />
&lt;menuitem label=&quot;Menu A&quot; &gt;<br />
&lt;menuitem label=&quot;SubMenu A1&quot; type=&quot;check&quot;/&gt;<br />
&lt;menuitem label=&quot;SubMenu A2&quot; type=&quot;check&quot;/&gt;<br />
&lt;/menuitem&gt;<br />
&lt;menuitem label=&quot;Menu B&quot;/&gt;<br />
&lt;menuitem label=&quot;Menu C&quot; &gt;<br />
&lt;menuitem label=&quot;SubMenu C1&quot; type=&quot;radio&quot; groupName=&quot;smgroup&quot;/&gt;<br />
&lt;menuitem label=&quot;SubMenu C2&quot; type=&quot;radio&quot; groupName=&quot;smgroup&quot;/&gt;<br />
&lt;menuitem label=&quot;SubMenu C3&quot; type=&quot;radio&quot; groupName=&quot;smgroup&quot;/&gt;<br />
&lt;/menuitem&gt;<br />
&lt;/mx:XMLList&gt;<br />
&lt;/mx:MenuBar&gt;<br />
&lt;/mx:ApplicationControlBar&gt;<br />
&lt;/mx:Application&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/10/24/flex-3-application-control-bar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flex 3 AnimateProperty &#8211; Sequencing Animation</title>
		<link>http://manewc.com/2008/10/22/flex-3-animateproperty-sequencing-animation/</link>
		<comments>http://manewc.com/2008/10/22/flex-3-animateproperty-sequencing-animation/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 17:54:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex Web Development]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=221</guid>
		<description><![CDATA[Simple demonstration to perform a sequence of animation triggered by clicking the image below:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_AnimateProperty_259459758"
			class="flashmovie"
			width="700"
			height="700">
	<param name="movie" value="/projects/flex3/AnimateProperty/AnimateProperty.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/AnimateProperty/AnimateProperty.swf"
			name="fm_AnimateProperty_259459758"
			width="700"
			height="700">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>



	
		

    
        
        
		
        
		
        
  [...]]]></description>
			<content:encoded><![CDATA[<p>Simple demonstration to perform a sequence of animation triggered by clicking the image below:</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_AnimateProperty_828056060"
			class="flashmovie"
			width="700"
			height="700">
	<param name="movie" value="/projects/flex3/AnimateProperty/AnimateProperty.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/AnimateProperty/AnimateProperty.swf"
			name="fm_AnimateProperty_828056060"
			width="700"
			height="700">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<pre name="code" class="c-sharp">
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
	<mx:Script>
		<![CDATA[
			import mx.effects.easing.Bounce;
	    ]]&gt;
	</mx:Script>

    <mx:Sequence id="animateSmiley" >
        <mx:AnimateProperty property="scaleX" fromValue="1" toValue="1.5" duration="1000" />
        <mx:AnimateProperty property="scaleX" fromValue="1.5" toValue="1" duration="1000" />
		<mx:AnimateProperty property="alpha" fromValue="1" toValue=".5" duration="1000" />
        <mx:AnimateProperty property="alpha" fromValue=".5" toValue="1" duration="1000" />
		<mx:AnimateProperty property="x" fromValue="{smiley.x}" toValue="400" duration="1000" easingFunction="Bounce.easeOut" />
        <mx:AnimateProperty property="x" fromValue="400" toValue="300" duration="1000" easingFunction="Bounce.easeOut" />
    </mx:Sequence>

        <mx:Image id="smiley" source="@Embed(source='assets/smiley.png')" mouseDownEffect="{animateSmiley}"/>
</mx:Application>
</pre>
<p>Here is the code out of the editor:</p>
<p>&lt;?xml version=&quot;1.0&quot;?&gt;<br />
  &lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;&gt;<br />
  &lt;mx:Script&gt;<br />
  &lt;![CDATA[<br />
  import mx.effects.easing.Bounce;<br />
  ]]&gt;<br />
  &lt;/mx:Script&gt;</p>
<p>  &lt;mx:Sequence id=&quot;animateSmiley&quot; &gt;<br />
  &lt;mx:AnimateProperty property=&quot;scaleX&quot; fromValue=&quot;1&quot; toValue=&quot;1.5&quot; duration=&quot;1000&quot; /&gt;<br />
  &lt;mx:AnimateProperty property=&quot;scaleX&quot; fromValue=&quot;1.5&quot; toValue=&quot;1&quot; duration=&quot;1000&quot; /&gt;<br />
  &lt;mx:AnimateProperty property=&quot;alpha&quot; fromValue=&quot;1&quot; toValue=&quot;.5&quot; duration=&quot;1000&quot; /&gt;<br />
  &lt;mx:AnimateProperty property=&quot;alpha&quot; fromValue=&quot;.5&quot; toValue=&quot;1&quot; duration=&quot;1000&quot; /&gt;<br />
  &lt;mx:AnimateProperty property=&quot;x&quot; fromValue=&quot;{smiley.x}&quot; toValue=&quot;400&quot; duration=&quot;1000&quot; easingFunction=&quot;Bounce.easeOut&quot; /&gt;<br />
  &lt;mx:AnimateProperty property=&quot;x&quot; fromValue=&quot;400&quot; toValue=&quot;300&quot; duration=&quot;1000&quot; easingFunction=&quot;Bounce.easeOut&quot; /&gt;<br />
  &lt;/mx:Sequence&gt;
</p>
<p> &lt;mx:Image id=&quot;smiley&quot; source=&quot;@Embed(source=&#8217;assets/smiley.png&#8217;)&quot; mouseDownEffect=&quot;{animateSmiley}&quot;/&gt;<br />
  &lt;/mx:Application&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/10/22/flex-3-animateproperty-sequencing-animation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flex 3 DateField Component &#8211; Disable Date Range</title>
		<link>http://manewc.com/2008/10/21/flex-3-datefield-component-disable-date-range/</link>
		<comments>http://manewc.com/2008/10/21/flex-3-datefield-component-disable-date-range/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 17:43:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex Web Development]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=220</guid>
		<description><![CDATA[A little code to disable all dates earlier than yesterday

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_DateField_771929938"
			class="flashmovie"
			width="300"
			height="300">
	<param name="movie" value="/projects/flex3/DateField/DateField.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/DateField/DateField.swf"
			name="fm_DateField_771929938"
			width="300"
			height="300">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>



	
	
	

	


Here is the code outside of the editor:
&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;mx:Application xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; creationComplete=&#34;getDate()&#34;&#62;
&#60;mx:Script&#62;
&#60;!&#8211;[CDATA[
private function getDate():void
{
var today:Date = new Date();
var yesterday:Date = new Date(today.fullYear, today.month, today.date-1);
dateField.disabledRanges = [{rangeEnd:yesterday}];
}
]]&#8211;&#62;
&#60;/mx:Script&#62;
&#60;mx:DateField id=&#34;dateField&#34; yearNavigationEnabled=&#34;true&#34; /&#62;
&#60;/mx:Application&#62;

]]></description>
			<content:encoded><![CDATA[<p>A little code to disable all dates earlier than yesterday</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_DateField_640790327"
			class="flashmovie"
			width="300"
			height="300">
	<param name="movie" value="/projects/flex3/DateField/DateField.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/DateField/DateField.swf"
			name="fm_DateField_640790327"
			width="300"
			height="300">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<pre name="code" class="c-sharp">
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="getDate()">
	<mx:Script>
	<!--[CDATA[
		private function getDate():void
		{
			var today:Date = new Date();
			var yesterday:Date = new Date(today.fullYear, today.month, today.date-1);
			dateField.disabledRanges = [{rangeEnd:yesterday}];
		}
	]]-->
	</mx:Script>

	<mx:DateField id="dateField" yearNavigationEnabled="true" />
</mx:Application>
</pre>
<p>Here is the code outside of the editor:</p>
<p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; creationComplete=&quot;getDate()&quot;&gt;<br />
&lt;mx:Script&gt;<br />
&lt;!&#8211;[CDATA[<br />
private function getDate():void<br />
{<br />
var today:Date = new Date();<br />
var yesterday:Date = new Date(today.fullYear, today.month, today.date-1);<br />
dateField.disabledRanges = [{rangeEnd:yesterday}];<br />
}<br />
]]&#8211;&gt;<br />
&lt;/mx:Script&gt;</p>
<p>&lt;mx:DateField id=&quot;dateField&quot; yearNavigationEnabled=&quot;true&quot; /&gt;<br />
&lt;/mx:Application&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/10/21/flex-3-datefield-component-disable-date-range/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex 3 MouseDown / MouseUp Image Blur Effect</title>
		<link>http://manewc.com/2008/10/20/flex-3-mousedown-mouseup-image-blur-effect/</link>
		<comments>http://manewc.com/2008/10/20/flex-3-mousedown-mouseup-image-blur-effect/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 18:48:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex Web Development]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=219</guid>
		<description><![CDATA[Simply press the image to view the blur effect.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_BlurEffects_1085751354"
			class="flashmovie"
			width="700"
			height="620">
	<param name="movie" value="/projects/flex3/BlurEffects/BlurEffects.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/BlurEffects/BlurEffects.swf"
			name="fm_BlurEffects_1085751354"
			width="700"
			height="620">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>



    
    ]]></description>
			<content:encoded><![CDATA[<p>Simply press the image to view the blur effect.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_BlurEffects_2057764995"
			class="flashmovie"
			width="700"
			height="620">
	<param name="movie" value="/projects/flex3/BlurEffects/BlurEffects.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/BlurEffects/BlurEffects.swf"
			name="fm_BlurEffects_2057764995"
			width="700"
			height="620">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<pre name="code" class="c-sharp">
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Blur id="blurImage" duration="1000" blurXFrom="0.0" blurXTo="100.0" blurYFrom="0.0" blurYTo="10.0" />
    <mx:Blur id="unblurImage" duration="1000" blurXFrom="100.0" blurXTo="0.0" blurYFrom="10.0" blurYTo="0.0" " />
    <mx:Image id="flex" source="@Embed(source='assets/smiley.png')" mouseDownEffect="{blurImage}" mouseUpEffect="{unblurImage}" />
</mx:Application>
</pre>
<p>Another view of the code (corrected):</p>
<p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;&gt;<br />
&lt;mx:Blur id=&quot;blurImage&quot; duration=&quot;1000&quot; blurXFrom=&quot;0.0&quot; blurXTo=&quot;100.0&quot; blurYFrom=&quot;0.0&quot; blurYTo=&quot;10.0&quot; /&gt;<br />
&lt;mx:Blur id=&quot;unblurImage&quot; duration=&quot;1000&quot; blurXFrom=&quot;100.0&quot; blurXTo=&quot;0.0&quot; blurYFrom=&quot;10.0&quot; blurYTo=&quot;0.0&quot; &quot; /&gt;<br />
&lt;mx:Image id=&quot;flex&quot; source=&quot;@Embed(source=&#8217;assets/smiley.png&#8217;)&quot; mouseDownEffect=&quot;{blurImage}&quot; mouseUpEffect=&quot;{unblurImage}&quot; /&gt;<br />
&lt;/mx:Application&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/10/20/flex-3-mousedown-mouseup-image-blur-effect/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Simple RSS Reading with Flex</title>
		<link>http://manewc.com/2008/10/17/simple-rss-reading-with-flex/</link>
		<comments>http://manewc.com/2008/10/17/simple-rss-reading-with-flex/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 18:19:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex Web Development]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=217</guid>
		<description><![CDATA[This will take in my RSS feed and display the date, title and link to the page. A simple function that allows the row of data to send the user to the respective page.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ManewcRSS_170651953"
			class="flashmovie"
			width="700"
			height="300">
	<param name="movie" value="/projects/flex3/ManewcRSS/ManewcRSS.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/ManewcRSS/ManewcRSS.swf"
			name="fm_ManewcRSS_170651953"
			width="700"
			height="300">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>



	
		
	

	
		
			
			
			
		
	


You know, someday I will take the time to figure out the issues with the special character rendering [...]]]></description>
			<content:encoded><![CDATA[<p>This will take in my RSS feed and display the date, title and link to the page. A simple function that allows the row of data to send the user to the respective page.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ManewcRSS_95815873"
			class="flashmovie"
			width="700"
			height="300">
	<param name="movie" value="/projects/flex3/ManewcRSS/ManewcRSS.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/ManewcRSS/ManewcRSS.swf"
			name="fm_ManewcRSS_95815873"
			width="700"
			height="300">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<pre class="c-sharp" name="code">
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="pageLoad()">
	<mx:Script>
		<![CDATA[
			private function pageLoad ( ):void
			{
				myRSSFeed.send();
			}

			private function navigatePage ( url:String ):void
			{
				navigateToURL ( new URLRequest ( url ) );
			}
		]]&gt;
	</mx:Script>
	<mx:HTTPService id="myRSSFeed" url="http://manewc.com/feed" />

	<mx:DataGrid
		id="myDataGrid"
		dataProvider="{myRSSFeed.lastResult.rss.channel.item}"
		click="navigatePage(myRSSFeed.lastResult.rss.channel.item[myDataGrid.selectedIndex].link)"
		width="100%" height="100%" x="0" y="0"
		>
		<mx:columns>
			<mx:DataGridColumn headerText="Date" dataField="pubDate" textAlign="left"/>
			<mx:DataGridColumn headerText="Title" dataField="title" textAlign="left"/>
			<mx:DataGridColumn headerText="Link" dataField="link" textAlign="left"/>
		</mx:columns>
	</mx:DataGrid>
</mx:Application>
</pre>
<p>You know, someday I will take the time to figure out the issues with the special character rendering with my editor, but until then here is a screen cap:</p>
<p><img src="http://manewc.com/wp-content/uploads/2008/10/code1.gif" alt=""  /></p>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/10/17/simple-rss-reading-with-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Skinning a Button with Flex 3</title>
		<link>http://manewc.com/2008/10/07/skinning-a-button-with-flex-3/</link>
		<comments>http://manewc.com/2008/10/07/skinning-a-button-with-flex-3/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 16:21:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex Web Development]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=212</guid>
		<description><![CDATA[Sorry for the formatting of the code, my editor is having issues:
&#60;mx:Button label=&#8221;Image Button&#8221;
toggle=&#8221;true&#8221;
color=&#8221;0xFFFFAA&#8221;
textRollOverColor=&#8221;0xAAAA55&#8243;
textSelectedColor=&#8221;0xFFFF00&#8243;
upSkin=&#8221;@Embed(source=&#8217;assets/buttonUp.gif&#8217;)&#8221;
overSkin=&#8221;@Embed(source=&#8217;assets/buttonOver.gif&#8217;)&#8221;
downSkin=&#8221;@Embed(source=&#8217;assets/buttonDown.gif&#8217;)&#8221;
disabledSkin=&#8221;@Embed(source=&#8217;assets/buttonDisabled.gif&#8217;)&#8221;
icon=&#8221;@Embed(source=&#8217;assets/logo.gif&#8217;)&#8221;/&#62;
]]></description>
			<content:encoded><![CDATA[<p>Sorry for the formatting of the code, my editor is having issues:</p>
<p>&lt;mx:Button label=&#8221;Image Button&#8221;<br />
toggle=&#8221;true&#8221;<br />
color=&#8221;0xFFFFAA&#8221;<br />
textRollOverColor=&#8221;0xAAAA55&#8243;<br />
textSelectedColor=&#8221;0xFFFF00&#8243;<br />
upSkin=&#8221;@Embed(source=&#8217;assets/buttonUp.gif&#8217;)&#8221;<br />
overSkin=&#8221;@Embed(source=&#8217;assets/buttonOver.gif&#8217;)&#8221;<br />
downSkin=&#8221;@Embed(source=&#8217;assets/buttonDown.gif&#8217;)&#8221;<br />
disabledSkin=&#8221;@Embed(source=&#8217;assets/buttonDisabled.gif&#8217;)&#8221;<br />
icon=&#8221;@Embed(source=&#8217;assets/logo.gif&#8217;)&#8221;/&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/10/07/skinning-a-button-with-flex-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flex Associative Array with an Indexed Array</title>
		<link>http://manewc.com/2008/09/10/flex-associative-array-with-an-indexed-array/</link>
		<comments>http://manewc.com/2008/09/10/flex-associative-array-with-an-indexed-array/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 16:40:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex Web Development]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=196</guid>
		<description><![CDATA[The associative array are the stock names and the items are representing the indexed array.

var stockDetails:Object = new Object();
stockDetails["AAPL"] = ["+5", "152 Change"];
stockDetails["MCSFT"] = ["-20", "-10 Change", "Another Item"];

Reading the array, you can use a for loop

for ( var stock:String in stockDetails )
{
	trace ( stock + " -> " + stockDetails[stock] );
}

/* Trace:
----------------------
AAPL -> +5,152 [...]]]></description>
			<content:encoded><![CDATA[<p>The associative array are the stock names and the items are representing the indexed array.</p>
<pre name="code" class="c-sharp">
var stockDetails:Object = new Object();
stockDetails["AAPL"] = ["+5", "152 Change"];
stockDetails["MCSFT"] = ["-20", "-10 Change", "Another Item"];
</pre>
<p>Reading the array, you can use a for loop</p>
<pre name="code" class="c-sharp">
for ( var stock:String in stockDetails )
{
	trace ( stock + " -> " + stockDetails[stock] );
}

/* Trace:
----------------------
AAPL -> +5,152 Change
MCSFT -> -20,-10 Change,Another Item
*/
</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/09/10/flex-associative-array-with-an-indexed-array/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Downloading Files with Flex 3</title>
		<link>http://manewc.com/2008/08/28/downloading-files-with-flex-3/</link>
		<comments>http://manewc.com/2008/08/28/downloading-files-with-flex-3/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 17:21:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flex Web Development]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=185</guid>
		<description><![CDATA[So I was reviewing the documentation over at Adobe for downloading files with Flex &#8211; I tweaked the code a little so I can specify the file to download inside my .mxml file rather than the .as file  -this demo will download the source files for my papervision with multiple sides demo.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_FileDownload_848144097"
			class="flashmovie"
			width="700"
			height="300">
	<param name="movie" value="/projects/flex3/FileDownload/FileDownload.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/FileDownload/FileDownload.swf"
			name="fm_FileDownload_848144097"
			width="700"
			height="300">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>]]></description>
			<content:encoded><![CDATA[<p>So I was reviewing the documentation over at <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_9.html">Adobe for downloading files with Flex</a> &#8211; I tweaked the code a little so I can specify the file to download inside my .mxml file rather than the .as file  -this demo will download the source files for my papervision with multiple sides demo.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_FileDownload_2011350180"
			class="flashmovie"
			width="700"
			height="300">
	<param name="movie" value="/projects/flex3/FileDownload/FileDownload.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/FileDownload/FileDownload.swf"
			name="fm_FileDownload_2011350180"
			width="700"
			height="300">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Here is my modified class file, I simply made the DOWNLOAD variable to be a public variable and added this as a parameter to the init function:</p>
<pre name="code" class="c-sharp">
package com.example.programmingas3.fileio {
    import flash.events.*;
    import flash.net.FileReference;
    import flash.net.URLRequest;

    import mx.controls.Button;
    import mx.controls.ProgressBar;
    import mx.core.UIComponent;

    public class FileDownload extends UIComponent {

        public var DOWNLOAD_URL:String;
        private var fr:FileReference;
        // Define reference to the download ProgressBar component.
        private var pb:ProgressBar;
        // Define reference to the "Cancel" button which will immediately stop the download in progress.
        private var btn:Button;

        public function FileDownload() {

        }

        /**
         * Set references to the components, and add listeners for the OPEN,
         * PROGRESS, and COMPLETE events.
         */
        public function init(pb:ProgressBar, btn:Button, dURL:String):void {
            // Set up the references to the progress bar and cancel button, which are passed from the calling script.
            this.pb = pb;
            this.btn = btn;

            DOWNLOAD_URL = dURL;

            fr = new FileReference();
            fr.addEventListener(Event.OPEN, openHandler);
            fr.addEventListener(ProgressEvent.PROGRESS, progressHandler);
            fr.addEventListener(Event.COMPLETE, completeHandler);
        }

        /**
         * Immediately cancel the download in progress and disable the cancel button.
         */
        public function cancelDownload():void {
            fr.cancel();
            pb.label = "DOWNLOAD CANCELLED";
            btn.enabled = false;
        }

        /**
         * Begin downloading the file specified in the DOWNLOAD_URL constant.
         */
        public function startDownload():void {
            var request:URLRequest = new URLRequest();
            request.url = DOWNLOAD_URL;
            fr.download(request);
        }

        /**
         * When the OPEN event has dispatched, change the progress bar's label
         * and enable the "Cancel" button, which allows the user to abort the
         * download operation.
         */
        private function openHandler(event:Event):void {
            pb.label = "DOWNLOADING %3%%";
            btn.enabled = true;
        }

        /**
         * While the file is downloading, update the progress bar's status and label.
         */
        private function progressHandler(event:ProgressEvent):void {
            pb.setProgress(event.bytesLoaded, event.bytesTotal);
        }

        /**
         * Once the download has completed, change the progress bar's label and
         * disable the "Cancel" button since the download is already completed.
         */
        private function completeHandler(event:Event):void {
            pb.label = "DOWNLOAD COMPLETE";
            pb.setProgress(0, 100);
            btn.enabled = false;
        }
    }
}
</pre>
<p>Here is my mxml file:</p>
<p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; xmlns:example=&quot;com.example.programmingas3.fileio.*&quot; xmlns=&quot;*&quot; horizontalAlign=&quot;center&quot;&gt;<br />
&lt;example:FileDownload id=&quot;fileDownload&quot; creationComplete=&quot;fileDownload.init(downloadProgress, cancelDownload,&#8217;http://manewc.com/projects/flash/PapervisionCubeSides/PapervisionCubeSides.zip&#8217;);&quot; /&gt;<br />
&lt;mx:HBox&gt;<br />
&lt;mx:Panel title=&quot;Download File&quot; paddingTop=&quot;10&quot; paddingBottom=&quot;10&quot; paddingLeft=&quot;10&quot; paddingRight=&quot;10&quot;&gt;<br />
&lt;mx:ProgressBar id=&quot;downloadProgress&quot; label=&quot;&quot; mode=&quot;manual&quot; /&gt;<br />
&lt;mx:ControlBar horizontalAlign=&quot;right&quot;&gt;<br />
&lt;mx:Button id=&quot;startDownload&quot; label=&quot;Download&#8230;&quot; click=&quot;fileDownload.startDownload();&quot; /&gt;<br />
&lt;mx:Button id=&quot;cancelDownload&quot; label=&quot;Cancel&quot; click=&quot;fileDownload.cancelDownload();&quot; enabled=&quot;false&quot; /&gt;<br />
&lt;/mx:ControlBar&gt;<br />
&lt;/mx:Panel&gt;<br />
&lt;/mx:HBox&gt;<br />
&lt;/mx:Application&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/08/28/downloading-files-with-flex-3/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
	</channel>
</rss>
