Flex 3 文件下载 - 无需 URLRequest
我的 Flex 客户端应用程序已从后端(RemoteObjects、BlazeDS、Spring)获取一些数据。客户端已获得所需的所有数据,现在需要将一些信息以 CSV 格式保存并可供下载。
为此使用 Flex 3。有什么想法吗?
谢谢, 斯里
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您正在针对 Flash Player 10 进行编译,则可以调用
FileReference.save()
函数将其保存到本地文件系统:http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3 /flash/net/FileReference.html#save()
只需确保记下此部分:
如果无法针对 Flash Player 10 进行编译,唯一的其他选择是将数据发送到服务器并让用户从那里将其作为 CSV 下载。
您可以使用
FileReference.download()
以与save()
类似的方式执行此操作:http://help .adobe.com/en_US/FlashPlatform//reference/actionscript/3/flash/net/FileReference.html#download()
If you are compiling for Flash Player 10 then you can call the
FileReference.save()
function to save to the local file-system:http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3/flash/net/FileReference.html#save()
Just make sure you take note of this section:
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 tosave()
:http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3/flash/net/FileReference.html#download()
不幸的是你不能这样做。您必须使用 FileReference+URLRequest,无法即时创建可在 Flash Player 中下载的文件。
一种解决方法是在文本文件中显示数据并允许用户进行复制/粘贴。当然,只有当您拥有少量信息时,它才有效。
Unfortunately you cannot do it. You have to use FileReference+URLRequest, you cannot create on the fly a file available for download in Flash Player.
One workaround is to display your data in a text file and allow the user to do copy/paste. Of course, it works only if you have a small amount of information.