How do I get the full name of a file in Adobe AIR?
I am using something like this to find a file in AIR. I can get the filename, but I need the full filename. Is there a way to do this?
var file:FileReference = new FileReference();
file.addEventListener(Event.SELECT, selectHandler);
file.browse();
private function selectHandler(e:Event):void{
file.removeEventListener(Event.SELECT, selectHandler);
var name = file.name;
}
0
a source to share
3 answers
I'm not sure what FileReference
can provide you with the absolute path to the file of your choice. So I suggest you use the property nativePath
File
instead of FileReference
.
var file:File = File.userDirectory;
file.addEventListener(Event.SELECT, selectHandler);
file.browse();
private function selectHandler(e:Event):void{
file.removeEventListener(Event.SELECT, selectHandler);
var filePath:String= file.nativePath;
}
+1
Prashant khanal
a source
to share