Posts Tagged open file
With the recent release of the Adobe Flex SDK 3.3 comes the fantastic new
FileReference 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.
FileReference it’s as simple as this:
var myFileReference:FileReference = new FileReference(); myFileReference.save("i just put some string data here lol", "filename.txt");
and you’re done!
To get access to this functionality you will need to download the Flex 3.3 SDK.
If you are using FlexBuilder:
- install the sdk in the “sdks” directory of your FlexBuilder installation
- in Windows » Preferences » Flex » Installed Flex SDKs: Add the new SDK by simply pointing to the SDK path (and set it as default)
- make sure that your project’s preferences is set to use the new SDK
- Finally, set your project to demand at least Flash Player 10 from users (if you plan on using any of the new Classes)
A very slight drawback for this simple but fantastic feature is that the code triggering the
FileReference has to be initiated by a user
Event. For security reasons of course.
This feature made me very happy and saved our project from at least a day of writing serverside crap.