问题
I wonder how can I download/save/write a file from my server to a client's computer using flash or flex.
An example of what I'm looking for is avilable on http://www.flexdownloads.com
- Sign up
- Sign in
- Click on the ("FREE") button placed on the right of the page. (the orange button)
- Choose any product (won't cost you anything)
- Press "BUY NOW"
then you'll see a confirmation popup for the download, then you choose where do you want to save the file, and the flash movie saves the file!
回答1:
Use FileReference
http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_7.html
var request:URLRequest = new URLRequest("index.xml");
var fileRef:FileReference = new FileReference();
fileRef.download(request);
来源:https://stackoverflow.com/questions/4198212/download-save-write-a-file-on-the-clients-hard-disk-using-flash-flex