I am developing an app for Adobe AIR. The app works fine on Adobe Flash CC when I run it through the ADL. When I publish the app for Desktop and run it, I get the following error: VerifyError: Error #1014: Class flash.filesystem::File could not be found.
This is strange, because it seems that actually, when I run the app outside Adobe Flash, the app is run through Flash Player.
The code that causes the problem is this:
import flash.filesystem.File;
import flash.filesystem.FileStream;
import flash.filesystem.FileMode;
function saveData(): void {
var pathToFile: String = File.documentsDirectory.resolvePath('test.txt').nativePath;
var someFile: File = new File(pathToFile);
var stream: FileStream = new FileStream();
stream.open(someFile, FileMode.WRITE);
stream.writeUTFBytes(csv);
stream.close();
}
It crashes on
var pathToFile: String = File.documentsDirectory.resolvePath('test.txt').nativePath;
Any ideas?