Download/Save/Write a file on the client's hard disk using flash/flex

自古美人都是妖i 提交于 2019-12-24 01:44:07

问题


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

  1. Sign up
  2. Sign in
  3. Click on the ("FREE") button placed on the right of the page. (the orange button)
  4. Choose any product (won't cost you anything)
  5. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!