0
我有这个很奇怪的问题。我有一个登录我的AIR应用程序的过程。当我在Flash CS5.5中运行它时,我可以成功打开日志文件并对其进行修改。当我使用AIR 2.6发布应用程序(试用swf,exe和OS-X应用程序)时,应用程序会在我第一次尝试访问日志文件时冻结。我使用的代码如下:发布后文件无法工作AIR应用程序
public function log(action:String)
{
var file:File ;
var time:Date ;
var time_str:String ;
time = new Date();
time_str = time.getFullYear()+"-"+(time.getMonth()+1)+"-"+time.getDate();
try {
file = File.documentsDirectory.resolvePath("IdeasMappingData/" +time_str + "_" + "log.txt");
var stream:FileStream = new FileStream()
stream.open(file, FileMode.APPEND);
time_str += "\t"+time.getHours()+":"+time.getMinutes();
trace(time_str+"\t"+action);
stream.writeUTFBytes(time_str+"\t"+action+"\n");
stream.close();
} catch (error:IOError) {
trace("The stream could not be accessed for logging.");
}
}
任何帮助,非常感谢。谢谢。
我看不出有任何问题的代码,你确定问题在于这个功能,而不是其他地方? – Zhafur