flash 将 ByteArray 写入磁盘上的文件
我需要使用 Flash AS3 将 ByteArray 写入本地磁盘上的文件。 flash 应用程序在本地运行(它是一个投影仪 exe)。
我发现 FileReference 类带有 save() 函数,效果非常好。唯一的问题是,该函数打开一个文件浏览器,让用户选择存储文件的位置。但是 - 我已经将路径作为字符串保存到此位置而无需用户操作(因为我一次性将大量文件导出到此目录中并且不希望用户手动选择每个文件)。
有没有一种方法可以在不打开文件浏览器的情况下将字节数组从投影仪存储到本地磁盘?
我还使用 mdm Zinc,它实际上提供了一个将 ByteArray 保存到磁盘的函数,但该函数由于某些未知原因不起作用。我已经提交了错误报告,但我需要非常紧急地让它发挥作用,所以我正在寻找替代方案!
谢谢!
I need to write a ByteArray to a file on local disk with Flash AS3. The flashapplication is run locally (it's a projector exe).
I found the FileReference class with the save() function which works perfect. The only problem is, that this function opens a filebrowser and let's the user select where to store the file. However - i have the path already as string and need to save to this location without useraction (since i'm exporting a lot of files into this directory in one go and don't want the user to choose each one manually).
Is there a way to store a bytearray from a projector to local disk without opening a filebrowser?
I'm also using mdm Zinc, which actually provides a function to save a ByteArray to disk, but this function is for some unknown reasons not working. I already filed a bugreport, but I need to get this to work very urgently, so i'm looking for alternatives!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请注意,您正在将应用程序作为 .exe 运行,我假设您正在使用 AIR 的某种变体,并且具有访问文件系统的安全权限。您应该查看 FileStream 类。这是一个非常简单的示例,说明我如何使用它将 ByteArray 写入硬编码文件位置。
Noting that you are running your application as an .exe I assume you are using some variant of AIR, and have a security permission to access the filesystem. You should take a look at the FileStream class. Here is a very simple example of how I used it to write a ByteArray to a hard-coded file location.
如果你需要的只是持久性(读你写的东西),你可以看看 SharedObject。
If all you need is persistence (you read what you write), you can take a look at SharedObject.