function writeAirFile():void
{
// Change the folder path to whatever you want plus name your mp3
// If the folder or folders does not exist it will create it.
var file:File = new File("/mnt/sdcard/new/new.apk");
//file.nativePath = "/mnt/sdcard/new/new.apk";
trace(file.nativePath);
fileStream.open(file, FileMode.WRITE);
fileStream.writeBytes(fileData, 0, fileData.length);
fileStream.close();
trace("The file is written.");
trace(file.nativePath);
}
需要工作,但事实并非如此。 我已经添加了当地storge写作的许可 拜托,我需要帮助 非常感谢大家的帮助!
答案 0 :(得分:1)
指出自定义目录不是最佳做法,您可以使用File.applicationStorageDirectory
,因此无需担心安全性和权限相关问题。
var file:File = File.applicationStorageDirectory.resolvePath("new/new.apk");
fileStream.open(file, FileMode.WRITE);
fileStream.writeBytes(fileData, 0, fileData.length);
fileStream.close();
trace("The file is written.");
trace(file.nativePath); // you can find where it is stored.
建议始终使用异步模式文件操作,以便即使文件大小太大也不会发生UI冻结。