hello evrey body i have try really hard to write a file to android and so far no secceus. this is the code i am using.
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);
}
uts need to work but it is not. i already add th permission for local storge writing please i need help thanks a lot for all of you for helping!
Point out custom directory is not best practices better you can use
File.applicationStorageDirectory
so no need worry about security and permission related issue.Suggestion always use Async mode file operation so that UI freeze won't happen even if file size is too large.