Open XML, modify and save on local


/ Published in: ActionScript 3
Save to your folder(s)

The ByteArray class is part of the flash.utils package and supports the reading and writing of binary data. The FileReference class is part of the flash.net package and is used to upload and download files from a local computer to a server.

In the code below, a XML file named personnel has a record appended to it and then is converted to a binary file using ByteArray and saved to disk with FileReference. The first time changes are made and saved, a new file is created on disk reflecting the changes made – this works fine in both Windows and Mac systems. Now the caveat; when the XML is modified a second time and saved, the code in Windows overwrites the previous version as expected – but in Mac OS10, the original XML is not overwritten but creates a new version of the file with the new version appended to the en


d of the previous version. I’ve located the bug report here but can find no solutions, work arounds or additional information.

URL: http://www.as3dtk.com/?p=459

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.