How Do I Open A Newly Written File From Application Storage Directory In As3 / Flex Mobile?
Solution 1:
Solved the issue... I was able to store / write my file in the documentsDirectory using:
var targetFile : File = File.documentsDirectory.resolvePath('test.jpg');
and then
navigateToURL(new URLRequest(targetFile.url));
And this works fine now. Hopefully it helps someone else! Seems that the storage directory SHOULD work but up until now I've only written to and read files stored there... maybe to open the files one HAS to copy it to a 'safe' location in the filesystem (i.e. sd card?)... will move on to test in ios Now - hope all works well in that OS. Thanks all who chimed in on this.
Solution 2:
My first hunch is that you need to specify the proper user-permissions in your application descriptor so you can use the openWith functionality with content from your application.
Remember that you need to specify this for IOS and Android specifically.
Solution 3:
On your application.xml you need this permissions set inside android > manifestAdditions > manifest:
<uses-permissionandroid:name="android.permission.INTERNET"/><uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
With this permissions you can save files to applicationStorageDirectory:
const FILE_LOADER:URLLoader = new URLLoader();
FILE_LOADER.addEventListener(Event.COMPLETE, onTempFileComplete);
FILE_LOADER.dataFormat = URLLoaderDataFormat.BINARY;
FILE_LOADER.load(new URLRequest(BASE_URL + filePath));
Solution 4:
The applicationStorageDirectory
can only be accessed by the application it belongs too when using Android or iOS. navigateToURL()
hands over your request to the default browser, which cannot access said directory.
documentsDirectory
is a public directory in Android, but not in iOS. So it cannot be used for both platforms. Unfortunately none of the pre-compiled file paths File
has point to a public directory in iOS. You can find a table explaining all the pre-compiled paths here
Post a Comment for "How Do I Open A Newly Written File From Application Storage Directory In As3 / Flex Mobile?"