air写文件 fileWriteResource错误

<!-- Deprecated. Use the .content or .hfeed class for styling instead of #content. -->

SecurityError: fileWriteResource

This error occured when i tried to write in a file which was in my applicationDirectory.

Here a little workout for you to solve this problem.

var applicationDirectoryPath:File = File.applicationDirectory;
var nativePathToApplicationDirectory:String = applicationDirectoryPath.nativePath.toString();
nativePathToApplicationDirectory+= "/my-config.mxml";
var file:File = new File(nativePathToApplicationDirectory);

var filestream:FileStream = new FileStream();
filestream.open(file, FileMode.WRITE);
filestream.writeUTFBytes("My Text");
filestream.close();

 

你可能感兴趣的:(Adobe,AIR)