转[]AIR读写外部文件
function saveData():void {
var _node:XML =;
_node.appendChild ({mc2.name_txt.text});
_node.appendChild ({mc2.tel_txt.text});
_node.appendChild ({mc2.num_txt.text});
_node.appendChild ({mc2.bogo_txt.text});
var _v:int=0;
while(_v<30){
_node.appendChild (<{"z"+(_v+1)}>{mc1.selected?"√":"×"}</{"z"+(_v+1)}>);
_v++;
}
xml.appendChild (_node);
//
var _fs:FileStream =new FileStream;
var _f:File =new File(File.applicationDirectory.resolvePath(xmlPath).nativePath);
_fs.open(_f,FileMode.WRITE);
_fs.writeMultiByte (xml,"utf-8");
_fs.close ();
//
var _str:String =getTitle();
for(var _i:int=0;_i<xml.item.length();_i++){
_str+=getData(xml.item)+"\r\n";
}
_fs =new FileStream;
_f =new File(File.applicationDirectory.resolvePath("data.txt").nativePath);
_fs.open(_f,FileMode.WRITE);
_fs.writeMultiByte (_str,"utf-8");
_fs.close ();
}