{"id":128,"date":"2008-12-19T00:00:34","date_gmt":"2008-12-19T07:00:34","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=397"},"modified":"2008-12-19T00:00:34","modified_gmt":"2008-12-19T07:00:34","slug":"filereferencesave","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=128","title":{"rendered":"FileReference.save()"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nvar file:FileReference = new FileReference();\r\n\r\nstage.addEventListener(MouseEvent.CLICK, onClick);\r\n\r\nfunction onClick(evt:MouseEvent):void {\r\n\tfile.save(&quot;some text. nsome more text&quot;, &quot;actionsnippet.txt&quot;);\r\n}\r\n<\/pre>\n<p>This is possibly my favorite feature of flash 10. Save any kind of file to the users computer&#8230; <\/p>\n<p>The first argument is for the data to put in the file, this can be a String, ByteArray or XML object. The second argument is the name of the file. <\/p>\n<p>As a test I also created one that saved a BitmapData object as a jpeg. But it doesn&#8217;t really fall into the category of snippet because it uses the Jpeg Encoder from adobe.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>var file:FileReference = new FileReference(); stage.addEventListener(MouseEvent.CLICK, onClick); function onClick(evt:MouseEvent):void { file.save(&quot;some text. nsome more text&quot;, &quot;actionsnippet.txt&quot;); } This is possibly my favorite feature of flash 10. Save any kind of file to the users computer&#8230; The first argument is for the data to put in the file, this can be a String, ByteArray or XML [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[94],"tags":[3,4],"class_list":["post-128","post","type-post","status-publish","format-standard","hentry","category-misc","tag-actionscript","tag-flash"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=128"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/128\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}