这可能有点 hacky,但是使用 getDirectoryListingAsync() 怎么样?您可以创建一个临时 File 对象,该对象指向您想要的文件所在的目录。调用异步处理程序时,您可以遍历结果,直到找到与目标匹配的文件,然后进行日期检查。像这样的东西:
var expectedName:String = "myFile";
var oldModificationDate:Date=new Date();
public function fileCheck(fileName:String)
{
File file = new File(fileName);
File dir = new File("/somefiles/localDir/");
dir.getDirectoryListingAsync();
dir.addEventListener(FileListEvent.DIRECTORY_LISTING, directoryListingHandler);
}
function directoryListingHandler(event:FileListEvent):void {
var list:Array = event.files;
for (var i:uint = 0; i < list.length; i++) {
if(list[i].name==expectedName && f.modificationDate.getTime() > oldModificationDate)
{
fileFoundHandler();
}
}
}
function fileFoundHandler():void
{
//your response code goes here
}