Oh sorry, I posted wrong code. DO you mean something like this:
var needstorage:File = ???;
if (File.permissionStatus != PermissionStatus.GRANTED) {
needstorage.addEventListener(PermissionEvent.PERMISSION_STATUS, function (e: PermissionEvent): void {
if (e.status == PermissionStatus.GRANTED) {
MovieClip(root).play();
} else {
// permission denied
}
});
try {
needstorage.requestPermission();
} catch (e: Error) {
// another request is in progress
}
} else {
stop();
needstorage.requestPermission();
}
In the other person's code they have this line:
var infoFile:File = obbDir.resolvePath(fileName);
That's more complicated than you're needs, in that they had an OBB files that had been extracted. This article gives some other examples, like the user's home directory. I don't know what folder you're going to try to write to, but perhaps the applicationStorageDirectory is the right one. That would give you lines like:
var needstorage:File = File.applicationStorageDirectory;
needstorage = needstorage.resolvePath("prefs.xml");
needstorage.addEventListener(PermissionEvent.PERMISSION_STATUS, function (etc)...
The 'prefs.xml' could be the name of the file you intend to write.