Flex 输出文件到本地的两种方法(flex如何使用)学到了

随心笔谈12个月前发布 admin
96 0

var ff:File=File.desktopDirectory.resolvePath(“Progress.CSV”);

ff.addEventListener(Event.SELECT,exportCSVSelectedHandler);

ff.browseForSave(“选择路径”);

private function exportCSVSelectedHandler(event:Event):void

{

var dir:String=event.target.nativePath;

var writeStream:FileStream=new FileStream();

writeStream.open(new File(dir),FileMode.WRITE);

var content:String=”jhfdklahflaksjdhflkasjhflaskjhlf\n”;

writeStream.writeMultiByte(content,’utf-8′);

writeStream.close();

}

© 版权声明

相关文章