<?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>Bagonca &#187; FileReference</title>
	<atom:link href="http://www.bagonca.com/blog/tag/filereference/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bagonca.com/blog</link>
	<description>Yet another developer blog</description>
	<lastBuildDate>Fri, 18 Jun 2010 09:28:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Triggering a Save File Dialogue from Flex</title>
		<link>http://www.bagonca.com/blog/2009/04/06/triggering-a-save-file-dialogue-from-flex/</link>
		<comments>http://www.bagonca.com/blog/2009/04/06/triggering-a-save-file-dialogue-from-flex/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 15:54:19 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[Flex/AS]]></category>
		<category><![CDATA[FileReference]]></category>
		<category><![CDATA[Flex and ActionScript]]></category>
		<category><![CDATA[open file]]></category>
		<category><![CDATA[save file]]></category>

		<guid isPermaLink="false">http://www.bagonca.com/blog/?p=63</guid>
		<description><![CDATA[Ever wanted to save a file directly from a Flex application to your local hard drive?]]></description>
			<content:encoded><![CDATA[<p>With the recent release of the <a title="Official Flex Team Blog" href="http://blogs.adobe.com/flex/archives/2009/03/flex_sdk_33_released_1.html" target="_blank">Adobe Flex SDK 3.3</a> comes the fantastic new <a title="API docs for FileReference" href="http://livedocs.adobe.com/flex/3/langref/flash/net/FileReference.html" target="_blank"><code>FileReference</code></a> class. Now, anybody who has ever worked in Flex must have been very annoyed with the fact that you actually sometimes have to write server side operations to be able to trigger normal loading and saving of files.</p>
<p>With <code>FileReference</code> it&#8217;s as simple as this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> myFileReference<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">FileReference</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">FileReference</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
myFileReference.<span style="color: #004993;">save</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;i just put some string data here lol&quot;</span>, <span style="color: #990000;">&quot;filename.txt&quot;</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>and you&#8217;re done!</p>
<p>To get access to this functionality you will need to <a href="http://www.adobe.com/support/documentation/en/flex/3/releasenotes_flex3_sdk.html#installation" target="_blank">download the Flex 3.3 SDK</a>.</p>
<p>If you are using FlexBuilder:</p>
<ul>
<li>install the sdk in the &#8220;sdks&#8221; directory of your FlexBuilder installation</li>
<li>in Windows &raquo; Preferences &raquo; Flex &raquo; Installed Flex SDKs: Add the new SDK by simply pointing to the SDK path (and set it as default)</li>
<li>make sure that your project&#8217;s preferences is set to use the new SDK</li>
<li>Finally, set your project to demand at least Flash Player 10 from users (if you plan on using any of the new Classes)</li>
</ul>
<p>A very slight drawback for this simple but fantastic feature is that the code triggering the <code>FileReference</code> has to be initiated by a user <code>Event</code>.  For security reasons of course.</p>
<p>This feature made me very happy and saved our project from at least a day of writing serverside crap.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bagonca.com/blog/2009/04/06/triggering-a-save-file-dialogue-from-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
