0
votes

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?

1
What Player do you have specified in File > Publish Settings?Brian
It's AIR 15.0.0.249 for Desktop. ActionScript 3.0tim

1 Answers

1
votes

You must publish Adobe AIR Application and not just "SWF" file.

Message:

VerifyError: Error #1014: Class flash.filesystem::File could not be found.

mean that your SWF was executed not from AIR but from simple Flash Player.

You must setup Target AIR for desktop (also download latest AIR SDK) like this:

enter image description here

Also you can select ways of distribution of your Application:

enter image description here

I suggest to use "Application with runtime embedded" because in this case you will receive App with all runtime included and your users will not receive any inconvenience with your software.