air遍历目录里的文件
air开发移动应用时,用于遍历一个目录里的所有文件:
var file:File = File.applicationDirectory.resolvePath("xxx"); var fileList:Array = file.getDirectoryListing(); for each(var f:* in fileList) { this.checkPath(f); }
_fileList = ; private function checkPath(file:File):void { if (file.isDirectory) { var list:Array = file.getDirectoryListing(); for each(var f:* in list) { this.checkPath(f); } }else { _fileList.push(file); } }