what should I do to overwrite my embed file (AIR app)
Hi,
I've got an AIR map that displays the tides.
The tides are in an xml file that I embed to my apk or ipa like this :

I'd like to have the possibility to overwrite this file. Problem : I don't know if AIR allows me to write or overwrite anything in the app directory.
I've tried this :
function startDownload():void{
var urlString:String = "http://mywebsite/horaires3.xml";
var urlReq:URLRequest = new URLRequest(urlString);
var urlStream:URLStream = new URLStream();
var fileData:ByteArray = new ByteArray();
urlStream.addEventListener(Event.COMPLETE, loaded);
urlStream.load(urlReq);
function loaded(event:Event):void {
urlStream.readBytes(fileData, 0, urlStream.bytesAvailable);
writeFile();
}
function writeFile():void {
var file:File = File.applicationStorageDirectory.resolvePath("horaires3.xml");
var fileStream:FileStream = new FileStream()
fileStream.open(file, FileMode.WRITE);
urlRemote_txt.text = file.url;
fileStream.writeBytes(fileData, 0, fileData.length);
fileStream.close();
trace("The AIR file is written.");
}
}
The new xml file is downloaded, no errors, but it doesn't seems to replace the original xml of the app..
link of the downloaded xml = app-storage:/horaires3.xml
link of the original xml = horaires3.xml
So, what do you suggest me to do ?
Is there a way to overwrite it ?