可以闪动作脚本读取和写入本地文件系统? [英] Can Flash action script read and write local file system?

查看:256
本文介绍了可以闪动作脚本读取和写入本地文件系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想这只能访问网络,但没有本地文件系统,而是从网上有些人说,这可以在最新的版本中,有谁能够确认?它可以达到任意文件或只是特定的位置?

I think it can only access the network but not local file system, but from internet some people said it can in the newest version, can anybody confirm? It can reach arbitrarily file or just a specific location?

感谢。 斌

推荐答案

在一般情况下,从Web服务器的SWF的不能从客户端计算机读取文件。但它可以上传用户选择从客户机文件到服务器。一个操作系统特定对话框,提示用户选择要上传到服务器上的文件。因此,Flash无法读取它想要的任何文件,只有那些被用户明确允许的。

In general, an SWF from a web-server cannot read files from the client machine. But it can upload user-selected files from the client machine to the server. An operating-system specific dialog box prompts the user to select the file to be uploaded to the server. Hence Flash cannot read any file it wants, only those that are explicitly permitted by the user.

Flash播放器10之前,SWF文件没有直接访问该文件被上传的内容 - 它所作的只是充当一个界面来选择文件并将其发送给服务器。以获得其内容的唯一方法就是将其回从服务器到SWF使用发送<一href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/URLLoader.html">URLLoader.

Before Flash player 10, the SWF didn't have direct access to the contents of the file being uploaded - all it did was act as an interface to select the file and send it to the server. The only way to get its contents was to send it back from the server to the SWF using URLLoader.

不过从FP10开始,<一个href="http://livedocs.adobe.com/flex/3/langref/flash/net/FileReference.html#methodSummary">FileReference类有负载()的方法,可以让你加载的用户选择文件直接到SWF的,而不是通过服务器传递给它。

However starting from FP10, the FileReference class has load() method that allows you to load the user selected file directly to the SWF, instead of passing it through the server.

类似的规则适用于下载 - 文件可以保存到用户的机器只能用他们的许可,并在用户指定的位置和名称。 FP10之前,你只能从服务器到客户端下载文件 - 如果你有一些图像使用SWF到客户端计算机创建,保存,你必须将其发送到服务器,然后提示用户下载。从FP10开始,您可以直接从SWF(从用户当然许可,)写入数据。

Similar rules apply to downloading - files can be saved into user's machine only with their permission and at the location and name specified by the user. Before FP10, you could only download a file from the server to the client - if you had to save some image created using your SWF to the client machine, you had to send it to the server and then prompt user to download it. Starting from FP10, you can write the data directly from SWF (with permission from the user, of course).


在除了这些,一个SWF可以存储<一href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/SharedObject.html">SharedObjects在客户机,它是类似的浏览器cookie。存储共享对象不包括来自用户的任何对话框或权限。以下是链接到上面的LiveDocs页面引用。

In addition to these, an SWF can store SharedObjects in the client machine which is analogous to the browser cookies. Storing shared objects doesn't involve any dialog boxes or permissions from the user. The following is quoted from the livedocs page linked to above.

本地共享对象有一定的局限性,重要的是考虑为您设计您的应用程序。有时,SWF文件可能不允许写入本地共享对象,有时可能存储在本地共享对象中的数据可以在您不知情被删除。 Flash Player用户可以管理磁盘空间,可对单个域或所有域。当用户减少磁盘空间量可用,一些本地共享对象可能会被删除。 Flash Player用户还具有隐私控件,可以读取或写入本地共享对象prevent第三方域(域比当前浏览器地址栏中的域名等)。

Local shared objects have some limitations that are important to consider as you design your application. Sometimes SWF files may not be allowed to write local shared objects, and sometimes the data stored in local shared objects can be deleted without your knowledge. Flash Player users can manage the disk space that is available to individual domains or to all domains. When users decrease the amount of disk space available, some local shared objects may be deleted. Flash Player users also have privacy controls that can prevent third-party domains (domains other than the domain in the current browser address bar) from reading or writing local shared objects.

这篇关于可以闪动作脚本读取和写入本地文件系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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