在 Flash 中读取本地文件 [英] Read local file in Flash

查看:19
本文介绍了在 Flash 中读取本地文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以读取 Flash 中的本地文件?我的应用程序使用 flash.net 将文件上传到服务器.FileReference 类,我想在上传它们之前先看看里面.有两个迹象表明为什么它可能是可能的:

Is it possible to read a local file in a Flash? My application uploads files to server using the flash.net.FileReference class, and I would like to peek inside before I upload them. There are two indications as to why it could be possible:

  • 无论如何我都会查看服务器上文件的内容.

  • I'm going to see the content of the files on the server anyway.

Silverlight 可以做到这一点.System.IO.FileInfo 类提供了一个流.

Silverlight can do that. The System.IO.FileInfo class provides a stream.

但到目前为止,一切都表明并非如此.文档中似乎什么也没有,谷歌搜索也没有发现任何有用的东西.在我继续之前,我只是想确保这不是真的可能.我知道可以在 AIR 中完成.

But so far, everything indicates otherwise. There seems to be nothing in the documentation, and a Google search has not revealed anything useful. I just want to make sure that it's not really possible before I move on. I'm aware that one can do it in AIR.

推荐答案

Flash Player 10 通过一个方法和一个属性 - FileReference.load() 和 FileReference.data 支持这一点.一旦用户使用 FileReference.browse() 选择了他们想要的文件,您就可以调用 load(),监听 Event.COMPLETE 事件,然后引用 data 属性来提取您想要的数据.

Flash Player 10 supports this via a method and a property - FileReference.load() and FileReference.data. Once the user has selected the file they want with FileReference.browse() you can then call load(), listen for the Event.COMPLETE event, and then reference the data property to pull out the data you want.

这篇关于在 Flash 中读取本地文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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