Note that there are some explanatory texts on larger screens.

plurals
  1. POFlash saves in Windows, not in Linux, FileReference.save()
    primarykey
    data
    text
    <p>The code below compiles fine on the Flex 4 SDK on Fedora 15. Mouse-click opens the dialog box, I click okay, and a file is saved, <strong>but the file is empty</strong>. I run the same SWF file (that was compiled on the Linux machine) on a Windows machine, and the created file contains the expected data.</p> <p>Then I broke the FileReference declaration out of the function into the class level, hoping to avoid <a href="http://www.techper.net/2007/12/30/flash-filereferencebrowse-problems-on-linux/" rel="nofollow">a known bug</a>, but the same problem persists.</p> <p>Hoping to set up a workaround, I added the debug Flash player to my path and ran the file from Flash without the benefit of the browser, and it <strong>works</strong>. So now a Flex problem has become a Firefox problem, maybe owing to a <a href="http://www.if-not-true-then-false.com/2010/install-adobe-flash-player-10-on-fedora-centos-red-hat-rhel/#install-adobe-flash-player-64-bit" rel="nofollow">shady procedure I used to install the plugin</a> without really understanding what was happening. I am running Firefox 5.0.</p> <p>In essence my workflow is fixed, but perhaps people who performed the above will not be able to use projects with FileReference.save()? Should I be worried about this edge case?</p> <pre><code>/* WriteTheFile.as Original code by Brian Hodge (brian@hodgedev.com) Test to see if ActionScript/Flash can write files */ package{ import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import flash.utils.ByteArray; import flash.net.FileReference; public class WriteTheFile extends Sprite { private var _xml:String; private var fr:FileReference; public function WriteTheFile():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); //Calling the save method requires user interaction and Flash Player 10 stage.addEventListener(MouseEvent.MOUSE_DOWN, _onMouseDown); } private function _onMouseDown(e:MouseEvent):void { fr = new FileReference() fr.save("&lt;xml&gt;&lt;test&gt;data&lt;/test&gt;&lt;/xml&gt;", "filename.txt"); } } } </code></pre> <p>EDIT: was missing a line, fixed above</p> <p>EDIT: addressed answer in code above, but the same problem exists.</p> <p>EDIT: This works on the same system when the standalone player is invoked. Therefore this is a browser (FF 5.0) plugin problem.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload