<?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>theDeSilva.com&#187; Flex</title>
	<atom:link href="http://www.thedesilva.com/category/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thedesilva.com</link>
	<description>Andrew de Silva</description>
	<lastBuildDate>Wed, 10 Mar 2010 21:48:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Batch File to Copy Flex Release Build to Production Server</title>
		<link>http://www.thedesilva.com/2010/02/batch-file-to-copy-flex-release-build-to-production-server/</link>
		<comments>http://www.thedesilva.com/2010/02/batch-file-to-copy-flex-release-build-to-production-server/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 22:19:04 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[batch file]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=194</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/>Here&#8217;s something that I always do when writing any sort of Flex Application. I&#8217;ll write a batch file that would allow me to quickly double click it and copy all of the files on the bin-release folder to the production server. This normally save me a lot of time as I don&#8217;t have to manually [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/><p>Here&#8217;s something that I always do when writing any sort of Flex Application. I&#8217;ll write a batch file that would allow me to quickly double click it and copy all of the files on the bin-release folder to the production server. This normally save me a lot of time as I don&#8217;t have to manually look for the files and copy them to the server.</p>
<p>Here&#8217;s a quick way to create the batch file and edit it to do what you want to ,</p>
<ol>
<li> Open up Notepad in Windows. You can do this by navigating to Start &gt; Programs &gt; Accessories &gt; Notepad, or simply by entering notepad under Start &gt; Run.</li>
<li> Save your file before you start writing any code</li>
<li> Go to File &gt; Save As.</li>
<li> Click on the dropdown box &#8220;Save as type:&#8221; and select &#8220;All files&#8221; instead of Text (*.txt).</li>
<li> Add .bat to the end of your file name before you save. For example copy.bat.</li>
<li> Click on Save.</li>
</ol>
<p>Now a little batch commands to delete the files that exist on the production server first before we copy the files from the bin-release folder to the production server followed by opening the page using the default browser.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">REM Delete old production files
del \\production_server_name\production_folder\*.*
REM Copy over <span style="color: #000080;">new</span> production files
copy *.* \\production_server_name\production_folder\
REM <span style="color: #000080;">Open</span> the location of the file using default browser
start www.production_server.com</pre></td></tr></table></div>

<p>The batch file should be located in the same folder as the files that you want to copy</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2010/02/batch-file-to-copy-flex-release-build-to-production-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embeding Collada files on Flex</title>
		<link>http://www.thedesilva.com/2009/08/embeding-collada-files-on-flex/</link>
		<comments>http://www.thedesilva.com/2009/08/embeding-collada-files-on-flex/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 16:11:49 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[embed collada]]></category>
		<category><![CDATA[mimetype]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=163</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/>Here&#8217;s how to embed collada files into your Flex. 1 2 3 4 5 6 7 &#160; &#91;Embed&#40;source=&#34;collada.dae&#34;, mimeType=&#34;application/octet-stream&#34;&#41;&#93; private var Model3D:Class; var byteArray:ByteArray = new Model3D&#40;&#41;; var collada:DAE = new DAE&#40;&#41;; collada.load&#40;byteArray, material&#41;; scene.addChild&#40;collada&#41;;]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/><p>Here&#8217;s how to embed collada files into your Flex.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">&nbsp;
<span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">&quot;collada.dae&quot;</span>, mimeType=<span style="color: #ff0000;">&quot;application/octet-stream&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Model3D:<span style="color: #000000; font-weight: bold;">Class</span>;
<span style="color: #000000; font-weight: bold;">var</span> byteArray:ByteArray = <span style="color: #000000; font-weight: bold;">new</span> Model3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> collada:DAE = <span style="color: #000000; font-weight: bold;">new</span> DAE<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
collada.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span>byteArray, material<span style="color: #66cc66;">&#41;</span>;
scene.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>collada<span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2009/08/embeding-collada-files-on-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restart A Flex Web Application</title>
		<link>http://www.thedesilva.com/2009/05/restart-a-flex-web-application/</link>
		<comments>http://www.thedesilva.com/2009/05/restart-a-flex-web-application/#comments</comments>
		<pubDate>Thu, 14 May 2009 20:42:45 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=146</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/>Here&#8217;s a quick way of restarting your Flex Application without reinitializing everything through a function navigateToURL&#40;new URLRequest&#40;Application.application.url&#41;, ‘_self’&#41;;]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/><p>Here&#8217;s a quick way of restarting your Flex Application without reinitializing everything through a function</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">navigateToURL<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span>Application.<span style="color: #006600;">application</span>.<span style="color: #0066CC;">url</span><span style="color: #66cc66;">&#41;</span>, ‘_self’<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2009/05/restart-a-flex-web-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Hand Cursor for Flex Component</title>
		<link>http://www.thedesilva.com/2009/04/creating-hand-cursor-for-flex-component/</link>
		<comments>http://www.thedesilva.com/2009/04/creating-hand-cursor-for-flex-component/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 20:48:16 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[hand cursor]]></category>
		<category><![CDATA[mouse cursor]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=140</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/>In order to change the mouse cursor to a hand cursor when a mouse over a particular component in Flex Component you will need to set useHandCursor = true , however if you set this to true you will not be able to get the hand cursor unless you set another two properties on the [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/><p>In order to change the mouse cursor to a hand cursor when a mouse over a particular component in Flex Component you will need to set useHandCursor = true , however if you set this to true you will not be able to get the hand cursor unless you set another two properties on the Flex component , buttonMode = true and mouseChildren = false. </p>
<p>Here&#8217;s an example</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> label:Label = <span style="color: #000000; font-weight: bold;">new</span> Label<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
label.<span style="color: #006600;">buttonMode</span> = <span style="color: #000000; font-weight: bold;">true</span>;
label.<span style="color: #0066CC;">useHandCursor</span> = <span style="color: #000000; font-weight: bold;">true</span>;
label.<span style="color: #006600;">mouseChildren</span> = <span style="color: #000000; font-weight: bold;">false</span>;</pre></td></tr></table></div>

<p>Once you set all three property of the component you will have the hand cursor when the mouse moves over the flex component.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2009/04/creating-hand-cursor-for-flex-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MouseEvent.DOUBLE_CLICK Not Firing</title>
		<link>http://www.thedesilva.com/2009/03/mouseeventdouble_click-not-firing/</link>
		<comments>http://www.thedesilva.com/2009/03/mouseeventdouble_click-not-firing/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 00:36:20 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[double click]]></category>
		<category><![CDATA[MouseEvent.DOUBLE_CLICK]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=126</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flash_small.png" width="32" height="32" alt="" title="Flash" /><img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/>Recently I was working on a project that I was using MouseEvent.DOUBLE_CLICK and the darn thing wasn&#8217;t firing no matter how many times that I&#8217;ve clicked on it. After awhile I remember that most  Flex component actually have a doubleClickEnable property . Guess what was the result of the trace when I did 1 trace&#40;image.doubleClickEnabled&#41; [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flash_small.png" width="32" height="32" alt="" title="Flash" /><img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/><p>Recently I was working on a project that I was using MouseEvent.DOUBLE_CLICK and the darn thing wasn&#8217;t firing no matter how many times that I&#8217;ve clicked on it. After awhile I remember that most  Flex component actually have a doubleClickEnable property . Guess what was the result of the trace when I did</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>image.<span style="color: #006600;">doubleClickEnabled</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">// this will return false</span></pre></td></tr></table></div>

<p>The simple solution for getting MouseEvent.DOUBLE_CLICK to work is to ensure that you set the property of doubleClickEnable to true</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;">image.<span style="color: #006600;">doubleClickEnabled</span> = <span style="color: #000000; font-weight: bold;">true</span>;
image.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">DOUBLE_CLICK</span>, double_click<span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2009/03/mouseeventdouble_click-not-firing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Warning: Unable to bind to property ‘XXX’ on class ‘XXX’</title>
		<link>http://www.thedesilva.com/2009/02/flex-warning-unable-to-bind-to-property-%e2%80%98xxx%e2%80%99-on-class-%e2%80%98xxx%e2%80%99/</link>
		<comments>http://www.thedesilva.com/2009/02/flex-warning-unable-to-bind-to-property-%e2%80%98xxx%e2%80%99-on-class-%e2%80%98xxx%e2%80%99/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 17:03:18 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=119</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/>While working on a new project using Flex and Webservices, I got this annoying message when I&#8217;m trying to use dataprovider and custom ItemRenderer warning: unable to bind to property ‘xxx’ on class ‘xxx’ (class is not an IEventDispatcher) warning: unable to bind to property ‘xxx’ on class ‘xxx’ (class is not an IEventDispatcher) This [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/><p>While working on a new project using Flex and Webservices, I got this annoying message when I&#8217;m trying to use dataprovider and custom ItemRenderer</p>
<p><em>warning: unable to bind to property ‘xxx’ on class ‘xxx’ (class is not an IEventDispatcher)<br />
warning: unable to bind to property ‘xxx’ on class ‘xxx’ (class is not an IEventDispatcher)</em><br />
This is happening because binding fails when using complex objects  , the compiler doesn&#8217;t know what kind of datatype that is being looped in the Repeater class and spits out a warning. Depending on what you are trying to do , sometimes it wont even spit out the data. The quick solution is to extend your class to Object and to make it bindable.</p>
<p>Here&#8217;s an example</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">thedesilva</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">rpc</span>.<span style="color: #006600;">soap</span>.<span style="color: #006600;">types</span>.<span style="color: #66cc66;">*</span>;
<span style="color: #808080; font-style: italic;">/**
* Wrapper class for a operation required type
*/</span>
<span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Magazine <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">Object</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #808080; font-style: italic;">/**
* Constructor, initializes the type class
*/</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Magazine<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> id:<span style="color: #0066CC;">String</span>;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> imagename:<span style="color: #0066CC;">String</span>;
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">name</span>:<span style="color: #0066CC;">String</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2009/02/flex-warning-unable-to-bind-to-property-%e2%80%98xxx%e2%80%99-on-class-%e2%80%98xxx%e2%80%99/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tour de FLEX</title>
		<link>http://www.thedesilva.com/2008/11/tour-de-flex/</link>
		<comments>http://www.thedesilva.com/2008/11/tour-de-flex/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 17:01:26 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[flex components]]></category>
		<category><![CDATA[tour de flex]]></category>
		<category><![CDATA[tour de flex plugin]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=105</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/>Here&#8217;s a really cool Flex learning tool called Tour de Flex. Tour de Flex is a desktop application for exploring Flex capabilities and resources, including the core Flex components, Adobe AIR and data integration, as well as a variety of third-party components, effects, skins, and more. It&#8217;s a really great application as it provides alot [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/><p>Here&#8217;s a really cool Flex learning tool called Tour de Flex. Tour de Flex is a desktop application for exploring Flex capabilities and resources, including the core Flex components, Adobe AIR and data integration, as well as a variety of third-party components, effects, skins, and more.</p>
<p>It&#8217;s a really great application as it provides alot of examples with source code that will allow you to learn and also visualize the changes.  Below is a screenshot of Tour de FLEX Air Application</p>
<div id="attachment_106" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.thedesilva.com/wp-content/uploads/2008/11/tour_de_flex_air.png"><img class="size-medium wp-image-106" title="tour_de_flex_air" src="http://www.thedesilva.com/wp-content/uploads/2008/11/tour_de_flex_air-300x232.png" alt="Tour de FLEX Air Screen Short" width="300" height="232" /></a><p class="wp-caption-text">Tour de FLEX Air Screen Shot</p></div>
<p><span id="more-105"></span></p>
<p>The application is also available as a plugin to Flex Builder and Eclipse .  Once installed you can search by component name, tag or author and double-click any item in the results to immediately see the component in Tour de Flex.  The plugin provides a search interface to the 200+ samples in Tour de Flex . It&#8217;s pretty simple to install it on Flex Builder 3 . Here are the instructions to install it in Flex Builder</p>
<ol>
<li>Click on Help -&gt; Software Updates -&gt; Find and Install</li>
<li>Click on Search for New Feature to Install</li>
<li>Click on New Remote Site and enter <strong>http://tourdeflex.adobe.com/eclipse</strong> on the URL</li>
<li>You can type anything you want for the Name of the Remote Site. In my case I just put it as Adobe</li>
<div id="attachment_109" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.thedesilva.com/wp-content/uploads/2008/11/add_new_feature1.png"><img class="size-medium wp-image-109" title="Adding Tour de Flex to Flex Builder 3" src="http://www.thedesilva.com/wp-content/uploads/2008/11/add_new_feature1-300x278.png" alt="Adding Tour de Flex to Flex Builder 3" width="300" height="278" /></a><p class="wp-caption-text">Adding Tour de Flex to Flex Builder 3</p></div>
<li>Click OK and then click Finish</li>
<li>You will be presented with a list of new features that you can install , Select Tour de Flex and click Finish</li>
<li>Once installed, a new Tour de Flex view is available to add.</li>
<li>If you can&#8217;t find the Tour de Flex view on the Window preferences up top of your Flex Builder options then it could be hidden.  If that&#8217;s the case then follow on to the next step</li>
<li>Click Windows -&gt; Other View -&gt; Tour de Flex and you should be able to view the Tour de Flex Window which looks like below
<p><div id="attachment_110" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.thedesilva.com/wp-content/uploads/2008/11/eclipse-plugin-screenshot.png"><img class="size-medium wp-image-110" title="Tour de Flex Eclipse Plugin Screenshot" src="http://www.thedesilva.com/wp-content/uploads/2008/11/eclipse-plugin-screenshot-300x136.png" alt="Tour de Flex Eclipse Plugin Screenshot" width="300" height="136" /></a><p class="wp-caption-text">Tour de Flex Eclipse Plugin Screenshot</p></div></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2008/11/tour-de-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash 10 File Reference</title>
		<link>http://www.thedesilva.com/2008/11/flash-10-file-reference/</link>
		<comments>http://www.thedesilva.com/2008/11/flash-10-file-reference/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 20:43:09 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[fileReference]]></category>
		<category><![CDATA[flash player 10]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=87</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/>Prior to Flash Player 10 , if you need to write or read a file to a user system , you would need to bounce it off a server and then load it back to the user system before you can even access the file. This is no longer true in Flash Player 10 . [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/><p>Prior to Flash Player 10 , if you need to write or read a file to a user system , you would need to bounce it off a server and then load it back to the user system before you can even access the file. This is no longer true in Flash Player 10 . The new API on FileReference class allows you to save and load file that is selected by the user , they are</p>
<p><strong>FileReference.load()</strong> &#8211; loads data from a file that is selected by the user</p>
<p><strong>FileReference.save()</strong> &#8211; save data to a file that is selected by the user</p>
<p>However , in order for the save() and load() to be called it need to be in response to a user interaction such as a button click and the location of the files cannot be exposed to Actionscript.</p>
<p><span id="more-87"></span></p>
<p>Below are the examples to use this new API</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #0066CC;">Button</span>;
<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">controls</span>.<span style="color: #006600;">TextArea</span>;
&nbsp;
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">FileReference</span>;
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
&nbsp;
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">ByteArray</span>;
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> fileReference:FileReference;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> textArea:TextArea = <span style="color: #000000; font-weight: bold;">new</span> TextArea<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> loadButton:<span style="color: #0066CC;">Button</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Button</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> saveButton:<span style="color: #0066CC;">Button</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Button</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> myFilter:FileFilter = <span style="color: #000000; font-weight: bold;">new</span> FileFilter<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Text&quot;</span>,<span style="color: #ff0000;">&quot;*.txt&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
	textArea.<span style="color: #0066CC;">width</span> = <span style="color: #cc66cc;">200</span>;
	textArea.<span style="color: #0066CC;">height</span> = <span style="color: #cc66cc;">200</span>;
	addChild<span style="color: #66cc66;">&#40;</span>textArea<span style="color: #66cc66;">&#41;</span>;
&nbsp;
	saveButton.<span style="color: #006600;">label</span> = <span style="color: #ff0000;">&quot;Save&quot;</span>
	<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>saveButton<span style="color: #66cc66;">&#41;</span>;
	saveButton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>,saveFile<span style="color: #66cc66;">&#41;</span>;
&nbsp;
	loadButton.<span style="color: #006600;">label</span> = <span style="color: #ff0000;">&quot;Upload Text File&quot;</span>
	<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>loadButton<span style="color: #66cc66;">&#41;</span>;
	loadButton.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>,loadFile<span style="color: #66cc66;">&#41;</span>;	
&nbsp;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> saveFile<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
	fileReference = <span style="color: #000000; font-weight: bold;">new</span> FileReference<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	fileReference.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span>textArea.<span style="color: #0066CC;">text</span>,<span style="color: #ff0000;">&quot;test.txt&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> loadFile<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
	fileReference = <span style="color: #000000; font-weight: bold;">new</span> FileReference<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	fileReference.<span style="color: #006600;">browse</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>myFilter<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
	fileReference.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">SELECT</span>,selectFile<span style="color: #66cc66;">&#41;</span>;
	fileReference.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>,loadText<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> selectFile<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
	fileReference.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> loadText<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">data</span>:ByteArray = fileReference.<span style="color: #0066CC;">data</span>;
	textArea.<span style="color: #0066CC;">text</span> = <span style="color: #0066CC;">data</span>.<span style="color: #006600;">readUTFBytes</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>.<span style="color: #006600;">bytesAvailable</span><span style="color: #66cc66;">&#41;</span>;
	fileReference = <span style="color: #000000; font-weight: bold;">null</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Of course you can also use Event Listeners to make sure that the file are properly loaded or if the user canceled the file browsing.</p>
<p>Here&#8217;s the working example</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_demo_809471660"
			class="flashmovie"
			width="400"
			height="290">
	<param name="movie" value="http://www.thedesilva.com/wp-content/uploads/2008/11/demo.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.thedesilva.com/wp-content/uploads/2008/11/demo.swf"
			name="fm_demo_809471660"
			width="400"
			height="290">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p><a title="Flash 10 File Reference" href="http://www.thedesilva.com/wp-content/uploads/2008/11/srcview/index.html" target="_blank">View Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2008/11/flash-10-file-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Flex 4 sdk codename &#8216;Gumbo&#8217; in Flex Builder 3</title>
		<link>http://www.thedesilva.com/2008/10/using-flex-4-sdk-codename-gumbo-in-flex-builder-3/</link>
		<comments>http://www.thedesilva.com/2008/10/using-flex-4-sdk-codename-gumbo-in-flex-builder-3/#comments</comments>
		<pubDate>Sat, 18 Oct 2008 20:46:49 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex 4]]></category>
		<category><![CDATA[Flex 4 SDK]]></category>
		<category><![CDATA[Flex Builder 3]]></category>
		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=75</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/>If you haven&#8217;t heard about the next version of Flex , code name Gumbo is now in development. According to Adobe&#8217;s Open Source site , the next version of Flex has 3 primary themes : Design in Mind: provide a framework meant for continuous collaboration between designer and developer. Developer Productivity: improve compiler performance and [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/><p>If you haven&#8217;t heard about the next version of Flex , code name Gumbo is now in development. According to Adobe&#8217;s Open Source site , the next version of Flex has 3 primary themes :</p>
<blockquote>
<ul>
<li><strong>Design in Mind</strong>: provide a framework meant for continuous collaboration between designer and developer.</li>
<li><strong>Developer Productivity</strong>: improve compiler performance and add productivity enhancements to language features like data binding</li>
<li><strong>Framework Evolution</strong>: take advantage of new Flash Player capabilities and add features required by common use-cases</li>
</ul>
</blockquote>
<p>Here&#8217;s instructions on how to use Gumbo SDK in your Flex Builder 3.</p>
<p><span id="more-75"></span></p>
<ol>
<li>First you will need to <a title="Flex Gumbo SDK Nightly Build" href="http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4/" target="_blank">download the lastest Gumbo SDK nightly build</a> from <a title="Flex 4 Gumbo " href="http://opensource.adobe.com/wiki/display/flexsdk/Gumbo" target="_blank">opensource.adobe.com</a>. Once you downloaded the zip file you will need to extract them to your hard drive.</li>
<li>You will also need Flash Player version 10 , download it from Adobe.com or click here for <a title="Get Flash Player 10" href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">Flash Player 10</a>.</li>
<li>Put the newly extracted folder in flex builders sdk directory , which would be in C:\Program Files\Adobe\Flex Builder 3\sdks ( this would be your default installation folder it will different if you changed it ).</li>
<li>Now we need to configure your Flex Builder 3 in order to use this SDK. Launch Flex Builder and then goto Window -&gt; Preference and you should see the window below.</li>
<div id="attachment_76" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.thedesilva.com/wp-content/uploads/2008/10/flex_builder_3_preference.jpg"><img class="size-full wp-image-76" title="Flex Builder 3 Preference Window" src="http://www.thedesilva.com/wp-content/uploads/2008/10/flex_builder_3_preference.jpg" alt="Flex Builder 3 Preference Window" width="500" height="330" /></a><p class="wp-caption-text">Flex Builder 3 Preference Window</p></div>
<li>Now click &#8220;Add&#8221; and browse into your Flex SDK directory and select the folder where your Flex Gumbo SDK is located and Flex Builder should be able to retrieve the SDK name by itself. Click the &#8220;OK&#8221; button. I would suggest keeping the old Flex 3 SDK as the default SDK and choose the Flex Gumbo SDK each time you need to use it.</li>
<li>Now that we have Flex Gumbo SDK availabe in your Flex Builder let&#8217;s create new project to use it. In Flex Builder 3 , click on &#8220;New Project&#8221; to create a new project and after the project is created goto the project properties by right clicking on the project in the Flex Navigator Tab and then click &#8220;Properties&#8221;. In the &#8220;Properties&#8221; dialog click on &#8220;Flex Compiler&#8221; and select &#8220;Use a specific SDK&#8221;  , here you should select the Gumbo SDK that you have installed as your sdk and change the &#8220;Require Flash Version&#8221; to 10.0.0.</li>
<div id="attachment_77" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.thedesilva.com/wp-content/uploads/2008/10/flex_builder_3_preference2.jpg"><img class="size-full wp-image-77" title="Flex Builder 3 Project Properties" src="http://www.thedesilva.com/wp-content/uploads/2008/10/flex_builder_3_preference2.jpg" alt="Flex Builder 3 Project Properties" width="500" height="434" /></a><p class="wp-caption-text">Flex Builder 3 Project Properties</p></div>
<li>That&#8217;s it , you should now be able to debug/compile your Flex project with Flex Gumbo SDK with Flash 10 features.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2008/10/using-flex-4-sdk-codename-gumbo-in-flex-builder-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Width and Height for Dynamic Image in Flex</title>
		<link>http://www.thedesilva.com/2008/07/width-and-height-for-dynamic-image/</link>
		<comments>http://www.thedesilva.com/2008/07/width-and-height-for-dynamic-image/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 22:03:42 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[dynamic image]]></category>
		<category><![CDATA[Height]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Width]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=38</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flash_small.png" width="32" height="32" alt="" title="Flash" /><img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/>Recently I was working on a Flex project and realize upon having my project on the live server , I couldn&#8217;t retrieve the height and width property of my loaded image by doing below var img:Image = new Image&#40;&#41;; img.source = &#34;image.jpg&#34; trace&#40;img.height&#41;; trace&#40;img.width&#41;; The trace statement above will just show 0 for both width [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flash_small.png" width="32" height="32" alt="" title="Flash" /><img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/><p>Recently I was working on a Flex project and realize upon having my project on the live server , I couldn&#8217;t retrieve the height and width property of my loaded image by doing below</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> img:Image = <span style="color: #000000; font-weight: bold;">new</span> Image<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
img.<span style="color: #006600;">source</span> = <span style="color: #ff0000;">&quot;image.jpg&quot;</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>img.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>img.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The trace statement above will just show 0 for both width and height. Of course after a few hours of searching Google for a solution I realized on the livedocs documentation for Image has the property contentWidth and contentHeight which provides the height and width of the image loaded.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> img:Image = <span style="color: #000000; font-weight: bold;">new</span> Image<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
img.<span style="color: #006600;">source</span> = <span style="color: #ff0000;">&quot;image.jpg&quot;</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>img.<span style="color: #006600;">contentHeight</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>img.<span style="color: #006600;">contentWidth</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2008/07/width-and-height-for-dynamic-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
