无法在 Flash Player 10 中写入本地文件+在线(但在本地使用时有效)
我正在尝试使用 FileReference 类使用 Flash Player 10+ 编写本地文件,遵循 Mike Chambers 的这篇博客文章中的格式: http://www.mikechambers.com/blog/2008/08/20/reading-and-writing-local-files-in-flash-player-10/
本质上代码是这:
private function onSaveButtonClick(event:MouseEvent):void{
fr = new FileReference();
fr.save(fileToSave);}
它在我的机器上本地工作正常,但在线使用时,单击“保存”按钮时不会弹出“保存文件”对话框。我认为这是某种权限或安全相关的问题?
I am trying to write a local file with Flash Player 10+ using the FileReference class, following the format from this blog post by Mike Chambers: http://www.mikechambers.com/blog/2008/08/20/reading-and-writing-local-files-in-flash-player-10/
Essentially the code is this:
private function onSaveButtonClick(event:MouseEvent):void{
fr = new FileReference();
fr.save(fileToSave);}
It works fine locally on my machine but when used online, it doesn't bring up the save file dialogue when the save button is clicked. I assume this is some sort of permissions or security related issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该检查日志中是否有
SecurityError
。当 IO 在本地工作但不能在线工作时,沙箱违规几乎总是原因。You should check your log for
SecurityError
s. A sandbox violation is nearly always the cause when IO works locally but not online.您的FileReference实例可能会被垃圾收集。文件上传也会发生同样的情况。
尝试将其移动到实例变量:
Your instance of FileReference might be garbage collected. Same happens with file upload.
Try to move it to instance variable: