AIR使用了弹出保存对话框开幕

AIR使用了弹出保存对话框开幕

本文介绍了执行自动保存与Adobe AIR使用了弹出保存对话框开幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个AIR应用程序,我想实现一个自动保存功能。目前,我有使用定时器来检查我的应用程序的当前活动文件的状态,那么如果文件更改到一个新的文件,该服务会检查当前文件名,如果已经改变,那​​么该文件已经修改的服务。当发生这种情况我想执行一个自动保存,这是我可以做的,但问题是,保存弹出保存对话框打开时,保存被调用,这就是我所说的保存功能:

I've an AIR app that I'd like to implement a auto-save functionality. Currently I have a service that uses a timer to check the status of the current active file in my app, then if the file changes to a new file, the service checks the current file name if that has changed then the file has changed.When this happens I want to perform a auto-save, which I can do but the problem is that the save popup save box opens when the save is called, this is how I call the save function:

var文件:文件= File.userDirectory.resolvePath(文件路径);file.save(jsonToExport);

var file:File = File.userDirectory.resolvePath( filepath );file.save( jsonToExport );

有没有办法来调用没有一个弹出框打开保存()函数?

Is there a way to call the save() function without a popup box opening?

感谢

斯蒂芬

推荐答案

而不是使用文件的保存方法,请尝试使用FileStream直接写入文件:

Rather than using the File's save method, try using a FileStream to write the file directly:

var file:File = File.userDirectory.resolvePath( filepath );

//Instantiate new file stream
var fs:FileStream = new FileStream();

//add optional event listener to do some action once finished
fs.addEventListener(Event.CLOSE, fileWrittenComplete);

//open the file in write mode
fs.openAsync(file, FileMode.WRITE);

//write your data to file
fs.writeUTFBytes(jsonToExport);

//close the file stream
fs.close();

这篇关于执行自动保存与Adobe AIR使用了弹出保存对话框开幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 19:05