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);
    }
}

猜你喜欢

转载自fis.iteye.com/blog/2185411
今日推荐