Flex 3的文件下载 - 如果没有的URLRequest [英] Flex 3 file download - Without URLRequest

查看:222
本文介绍了Flex 3的文件下载 - 如果没有的URLRequest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Flex客户端应用程序已经得到了来自后端的一些数据(RemoteObjects的,BlazeDS的,春季)。客户已经得到了所有的数据需要,现在需要把一个CSV格式的一些信息,并使其可用于下载。

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.

使用Flex 3本。任何想法?

Using Flex 3 for this. Any ideas?

谢谢, 斯里兰卡

推荐答案

如果您是编译为Flash Player 10,那么你可以调用 FileReference.save()函数保存到本地文件系统:

If you are compiling for Flash Player 10 then you can call the FileReference.save() function to save to the local file-system:

<一个href="http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3/flash/net/FileReference.html#save()" rel="nofollow">http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3/flash/net/FileReference.html#save()

只要确保你要注意这个部分的:

Just make sure you take note of this section:

在Flash Player中,你只能成功调用此方法在响应用户事件(例如,在事件处理函数点击鼠标或按键preSS事件)。否则,调用此方法将导致Flash Player引发Error异常。此限制不适用于应用程序沙箱中的AIR内容。

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.

如果您不能编译为Flash Player 10的唯一的另一种方法是将数据发送到服务器,并让用户从那里下载为CSV。

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.

您可以做到这一点的 FileReference.download()在simlar地保存(): <一href="http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3/flash/net/FileReference.html#download()" rel="nofollow">http://help.adobe.com/en_US/FlashPlatform//reference/actionscript/3/flash/net/FileReference.html#download()

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆