<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
layout="horizontal" fontSize="12"
creationComplete="getStudentInfo()" width="800" height="700">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
private function getStudentInfo():void{
var directory:File = new File("C:\\Documents and Settings\\a\\My Documents\\My Music");
var list:Array = directory.getDirectoryListing();
var str:String = "";
for(var i:Number = 0; i < list.length; i++){
var pattern:RegExp = new RegExp("\w*([-.]mp3)$");
str += pattern.test(list[i].nativePath) + " === " + list[i].nativePath +"\n";
// trace(list[i].nativePath);
}
txtTextAreaID.text = str;
}
]]>
</mx:Script>
<mx:Panel title="从目录中遍历所有文件并判断格式实例" verticalAlign="middle" horizontalAlign ="center" width="95%" height="95%">
<mx:TextArea id="txtTextAreaID" width="100%" height="100%" borderColor="#FF0000" borderThickness="5"/>
</mx:Panel>
</mx:WindowedApplication>
)flex(air)从目录中遍历所有文件并判断格式实例
最新推荐文章于 2023-09-24 22:02:01 发布