2009-05-24 9 views
0

AIR에서 파일을 탐색 할 때 이와 비슷한 방법을 사용하고 있습니다. 내가 파일 이름을 얻을 수는 있지만 필요한 것은 파일의 전체 이름입니다. 그렇게 할 수있는 방법이 있습니까?Adobe AIR에서 파일의 전체 이름을 얻으려면 어떻게해야합니까?

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

내 태그에서 볼 수 있듯이 Flash CS3을 사용하고 있습니다. – rabin

답변

1

FileReference이 선택한 파일의 절대 경로를 제공 할 수 있는지 확실하지 않습니다. 따라서 FileReference이 아닌 FilenativePath 속성을 사용하는 것이 좋습니다.

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; 
} 
+0

dang, 나는 틀린 종류를 사용하고 있었다. FileReference 대신 File을 사용하면됩니다. 감사합니다. – rabin

0

Flex Builder를 사용하고 있습니까? 나는 핸들러에 휴식을 넣고 사용할 수있는 것을 보았습니다. "name"속성은 디스크에있는 것처럼 파일 이름을 가져 오는 데 적합하기 때문에 상황에 어떤 문제가 있는지 알 수 없습니다.

+0

이름은 파일 이름과 다른 속성을 제공하지만 완전한 기본 경로는 제공하지 않습니다. – rabin

0

저는 전문가가 아니지만 file.nativePath는 어떻습니까?

+0

FileReference 클래스에 nativePath 속성이 없습니다. – rabin

관련 문제