Reputation: 3828
I am using as3 air and testing on an android.
I need to able to load, thru a browse feature, the sd card OR I need to point directly to that file folder thru a path.
I have successfully downloaded a zip file from a server. I can unzip it while testing on my desktop because I can browse to the correct path on desktop but not on phone. But I don't need the browse feature anyway, right now. I just need to be able to point to the applicationStorgeDirectory and the file in there. :)
I need the file var :)
var reader:ZipFileReader = new ZipFileReader();
reader.open(file); /// Help :)
UPDATE Sept 4th 2012 5pm
I tried this code:
var file:File = File.applicationStorageDirectory.resolvePath("myFile.zip");
trace(file.url); //path to the file
//assuming that function takes a string path
reader.open(file.url);
and I got this error:
Scene 1, Layer 'Layer 1', Frame 1, Line 46
1067: Implicit coercion of a value of type String
to an unrelated type flash.filesystem:File.
Upvotes: 1
Views: 4375
Reputation: 9600
Try the following. I've tested.
var file:File = File.applicationStorageDirectory.resolvePath("myFile.zip");
trace(file.url);
reader.open(file);
Upvotes: 1
Reputation: 6359
This should give you a url to an existing file
You could try something like this:
var file:File = File.applicationStorageDirectory.resolvePath("myFile.zip");
trace(file.url); //path to the file
//assuming that function takes a string path
reader.open(file.url);
Upvotes: 4