how load local html on air sdk harman

136 Views Asked by At

how load local html on air sdk harman, i use StageWebView on AS3, if i run on its normal view, but if i make apk and instal on android phone, its error. Application cannot showing local html. I use air SDK harman 33.1.1.554.

this my code :

var file:File = File.applicationDirectory.resolvePath("html");
var destinasi:File = File.applicationStorageDirectory;
file.copyTo(destinasi, true);
var hasil:String = "file://" + destinasi.resolvePath("index.html").nativePath;
isiMenu4.loadURL(hasil);

is there issue about security on air sdk by harman? how to skip that?

1

There are 1 best solutions below

1
On

This might be an issue where you don't have Android permission to write to local storage.

Try creating the directory first and see if that throws any errors.

_file = File.applicationStorageDirectory.resolvePath("html");
                    
trace("html.url", _file.url);
trace("html.nativePath", _file.nativePath);
                    
if (!_file.exists) {
_file.createDirectory();
//make storage directory non backupable
_file.preventBackup = true;
}