Flex 3文件下载 - 没有URLRequest [英] Flex 3 file download - Without URLRequest
问题描述
为此使用Flex 3。任何想法?
谢谢,
Sri
如果您正在为Flash Player 10进行编译,那么您可以调用 FileReference.save()
函数来保存到本地文件系统:
只要确保你记下这一节:
在Flash Player中,您只能成功响应一个用户来调用此方法事件(例如,在鼠标点击或按键事件的事件处理程序中)。否则,调用此方法会导致Flash Player抛出错误异常。此限制不适用于应用程序沙箱中的AIR内容。
唯一的其他替代方法,如果您无法为Flash Player 10编译是将数据发送到服务器,让用户以CSV格式从那里下载数据。
您可以使用 FileReference.download ()
以 save()
:
http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3 /flash/net/FileReference.html#download()
My Flex client app has got some data from the back end (RemoteObjects, BlazeDS, Spring). Client has got all the data it needs, it now needs to put some information in a CSV format and make it available for download.
Using Flex 3 for this. Any ideas?
Thanks, Sri
If you are compiling for Flash Player 10 then you can call the FileReference.save()
function to save to the local file-system:
Just make sure you take note of this section:
In Flash Player, you can only call this method successfully in response to a user event (for example, in an event handler for a mouse click or keypress event). Otherwise, calling this method results in Flash Player throwing an Error exception. This limitation does not apply to AIR content in the application sandbox.
The only other alternative if you can't compile for Flash Player 10 is to send the data to the server and have the user download it from there as a CSV.
You can do this with the FileReference.download()
in a simlar manner to save()
:
http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3/flash/net/FileReference.html#download()
这篇关于Flex 3文件下载 - 没有URLRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!