public function downLoad(sourceurl:String,targetfile:String):void{
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE,
function(e:Event):void
{
var airf:File =File.applicationStorageDirectory.resolvePath(targetfile);
trace(airf.nativePath);
//trace(airf.url);
var fs:FileStream = new FileStream();
fs.open(airf, FileMode.WRITE);
fs.writeBytes(loader.data);
fs.close();
airf.downloaded = true;
//打开此下载完成的文件
airf.openWithDefaultApplication();
});
loader.addEventListener(ProgressEvent.PROGRESS,function(e:ProgressEvent):void{
trace(e.bytesLoaded/e.bytesTotal+"/"+100);
});
var req:URLRequest = new URLRequest(sourceurl);
loader.load(req);
}