<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: AS3 Tips, Tricks and Experiments</title>
	<link>http://www.learningactionscript3.com/2009/06/30/as3-tips-tricks-and-experiments/</link>
	<description>A digital supplement for the O'Reilly book</description>
	<pubDate>Thu, 11 Mar 2010 02:23:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Zevan</title>
		<link>http://www.learningactionscript3.com/2009/06/30/as3-tips-tricks-and-experiments/#comment-4378</link>
		<dc:creator>Zevan</dc:creator>
		<pubDate>Thu, 22 Oct 2009 17:37:46 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2009/06/30/as3-tips-tricks-and-experiments/#comment-4378</guid>
		<description>@Marcos This feature is flash player 10 only... that message makes me think you may be using CS3 or publishing to flash player 9</description>
		<content:encoded><![CDATA[<p>@Marcos This feature is flash player 10 only&#8230; that message makes me think you may be using CS3 or publishing to flash player 9</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zevan</title>
		<link>http://www.learningactionscript3.com/2009/06/30/as3-tips-tricks-and-experiments/#comment-4339</link>
		<dc:creator>Zevan</dc:creator>
		<pubDate>Tue, 20 Oct 2009 20:13:22 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2009/06/30/as3-tips-tricks-and-experiments/#comment-4339</guid>
		<description>Hey Frank... your right... load() and browse() are the way to go.... have a look at this snippet:

&lt;pre&gt;
var file:FileReference = new FileReference();
file.addEventListener(Event.COMPLETE, onSaved);
stage.addEventListener(MouseEvent.CLICK, onSave);
function onSave(evt:MouseEvent):void {
	file.save("some text.\nsome more text", "actionsnippet.txt");
}

// user has saved the file... clicking again will bring up the browse window
function onSaved(evt:Event):void{
   file.removeEventListener(Event.COMPLETE, onSaved);
   stage.removeEventListener(MouseEvent.CLICK, onSave);
   stage.addEventListener(MouseEvent.CLICK, onBrowse);
}
 
// bring up the browse window in reponse to a mouse click
function onBrowse(evt:MouseEvent):void{
	file.browse([ new FileFilter("Text Files", "*.txt")]);
	file.addEventListener(Event.SELECT, onSelected);
}

// user has selected a file to upload from the localhost
function onSelected(evt:Event):void{
	stage.removeEventListener(MouseEvent.CLICK, onBrowse);
	file.removeEventListener(Event.SELECT, onSelected);
	file.load();
	file.addEventListener(Event.COMPLETE, onContentLoaded);
}

// the local file has been loaded, trace out the data and remove the last listener
function onContentLoaded(evt:Event):void{
	var txtContent:String  = String(evt.target.data);
	trace(txtContent);
	file.removeEventListener(Event.COMPLETE, onContentLoaded);
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hey Frank&#8230; your right&#8230; load() and browse() are the way to go&#8230;. have a look at this snippet:</p>
<pre>
var file:FileReference = new FileReference();
file.addEventListener(Event.COMPLETE, onSaved);
stage.addEventListener(MouseEvent.CLICK, onSave);
function onSave(evt:MouseEvent):void {
	file.save("some text.\nsome more text", "actionsnippet.txt");
}

// user has saved the file... clicking again will bring up the browse window
function onSaved(evt:Event):void{
   file.removeEventListener(Event.COMPLETE, onSaved);
   stage.removeEventListener(MouseEvent.CLICK, onSave);
   stage.addEventListener(MouseEvent.CLICK, onBrowse);
}

// bring up the browse window in reponse to a mouse click
function onBrowse(evt:MouseEvent):void{
	file.browse([ new FileFilter("Text Files", "*.txt")]);
	file.addEventListener(Event.SELECT, onSelected);
}

// user has selected a file to upload from the localhost
function onSelected(evt:Event):void{
	stage.removeEventListener(MouseEvent.CLICK, onBrowse);
	file.removeEventListener(Event.SELECT, onSelected);
	file.load();
	file.addEventListener(Event.COMPLETE, onContentLoaded);
}

// the local file has been loaded, trace out the data and remove the last listener
function onContentLoaded(evt:Event):void{
	var txtContent:String  = String(evt.target.data);
	trace(txtContent);
	file.removeEventListener(Event.COMPLETE, onContentLoaded);
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://www.learningactionscript3.com/2009/06/30/as3-tips-tricks-and-experiments/#comment-4338</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Tue, 20 Oct 2009 19:47:25 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2009/06/30/as3-tips-tricks-and-experiments/#comment-4338</guid>
		<description>There is code for &lt;span class='inlineas'&gt;FileReference.save()&lt;/span&gt; for saving a text file. Works great!

How do I load that same text into a text field using &lt;span class='inlineas'&gt;FileReference.load()&lt;/span&gt; and &lt;span class='inlineas'&gt;browse()&lt;/span&gt;?</description>
		<content:encoded><![CDATA[<p>There is code for <span class='inlineas'>FileReference.save()</span> for saving a text file. Works great!</p>
<p>How do I load that same text into a text field using <span class='inlineas'>FileReference.load()</span> and <span class='inlineas'>browse()</span>?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcos</title>
		<link>http://www.learningactionscript3.com/2009/06/30/as3-tips-tricks-and-experiments/#comment-4042</link>
		<dc:creator>Marcos</dc:creator>
		<pubDate>Tue, 29 Sep 2009 10:00:41 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2009/06/30/as3-tips-tricks-and-experiments/#comment-4042</guid>
		<description>The FileReference.save() method didn´t work to me. I´ve received the follow error:
1061: Call to a possibly undefined method save through a reference with static type flash.net:FileReference.</description>
		<content:encoded><![CDATA[<p>The FileReference.save() method didn´t work to me. I´ve received the follow error:<br />
1061: Call to a possibly undefined method save through a reference with static type flash.net:FileReference.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Weekly Shared Items &#8211; 6. July, 2009 &#124; TOXIN LABS - weblog of a german design student from wuerzburg</title>
		<link>http://www.learningactionscript3.com/2009/06/30/as3-tips-tricks-and-experiments/#comment-3287</link>
		<dc:creator>Weekly Shared Items &#8211; 6. July, 2009 &#124; TOXIN LABS - weblog of a german design student from wuerzburg</dc:creator>
		<pubDate>Mon, 06 Jul 2009 04:13:09 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2009/06/30/as3-tips-tricks-and-experiments/#comment-3287</guid>
		<description>[...] AS3 Tips, Tricks and Experiments [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] AS3 Tips, Tricks and Experiments [&#8230;]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
