In the new Flash Player 10, you will be able to write/read files without the need to send anything back to the server. Here are two examples using Flex, the first one is a Text-Pad where you are allowed to load a text file and save it without a need to communicate back to the server. The Second Example is similar but uses images instead. You are only allowed to upload PNG files in this example only. Also, there is a bug which supposedly got fixed but your are not allowed to overwrite the file you uploaded and when you are saving add “.txt” extension or “.png” extension, otherwise you can refresh the page and start again. In short, First time you hit save do not include the extension, second time you need to include the extension and remember to not overwrite anything otherwise it will crash.
EDIT: Ok it should work Now
Here is a PNG image you can save and try to upload.


23 Responses for "Using the new FileReference Class in Flex to save and load without a server"
Doesn’t seem to work with IE8 Beta + FP10.
Ya you are right, it works though if you compile it.
All right, I fixed it. Thanks
[...] in other words you have access to files at runtime. Now I did an example back then but It had some problems with a bug in the Flash Player 10. Now you can only upload and save Text [...]
i get this error:
ReferenceError: Error #1069: Property http://www.adobe.com/2008/actionscript/Flash10/::...not found on flash.net.FileReference and there is no default value.
at LiveCycle/onSaveImage()[C:ColdFusion8wwwrootLiveCyclesrcLiveCycle.mxml:34]
at LiveCycle/___LiveCycle_Button1_click()[C:ColdFusion8wwwrootLiveCyclesrcLiveCycle.mxml:71]
Mmmm, don't work for me….'possibly undefined method save/load to a reference with static type flash.net:FileReference….
I have problem with undefined method save/load to a reference with static type flash.net:FileReference….,,too????
It doesn't compile. I'm using Flex 3.2 SDK, getting
Error: Call to a possibly undefined method load through a reference with static type Class.
FileReference.load();
^
Also, the swf's on this page didn't work. I'm using flash 10 on firefox, XP.
Let me know if you have any helpful hints.
Thanks…
Same errors as above, obviously something related to flash 10…anyone identify the issue?
I don’t think this feature really works. You can compile that code with Flex 3.2, but no Flash Player 10 I found will actually play it back. Not the one with Flex 3.2, not the firefox or internet explorer player, not the standalone debug version. Admittedly I only tried Windows.
They all fail, because they don’t know the FileReference:load() property.
Too bad.
The code works flawlessly.
Remember to compile it with Gumbo (SDK 4) and not the classical SDK 3.2.
You'll also need Flash Player 10 of course.
No need to use Gumbo.
Only set the required flash player version at project properties to 10.0.0.
Well said Frank, you just need to change the Flex Compile in the project properties to 10.0.00
i am trying to load image reference your code. but it shows some error '1061: Call to a possibly undefined method load through a reference with static type flash.net:FileReference.” . pls tell me that solution. pls someone help me what is the succeed procedure.
check out : http://www.adylevy.com/index.php/2009/06/07/clien... for a source code for image manipulation on the client side.
Do you know how to use it to load a FLV or MP4 file?
Your example is not working. IE 7 Flash 10
Doesnt work with Firefix 3.5 + FP 10,0,22,87
Doesn’t work with Chrome 2.0.172.43 (Latest now) and Flash player 10,0,32,18 (Latest now)…
come on guys, works like a charm.. just listen to brothers Frank & Stickboy and compile for player 10.
Even i got the same error message. Just follow the below link
http://opensource.adobe.com/wiki/display/flexsdk/Targeting+Flash+Player+10
It works for me
Just spend some frustrating hours with that….
The Image-Sample provided here are not running for me (10,0,32,18).
Debug-Player throws an error related to missind load() method.
Compiled with Flex 3, 3.4.0.9271 FileReference works fine. I moved the Project to Flex 4 and compiled it with the included sdk 3.4.1.
Thats where the error is appearing in my case.
So now I use Flex 4 with sdk 3.4.0.9271 and it is working fine again.
So my conclusion:
Flex3 or 4 with sdk 3.4.0.9271 OK
Flex3 or 4 with sdk 3.4.1 ERROR
Flex4 with sdk4 NOT TESTED
Thanks for writing, I very much liked
Leave a reply