im doing a level editor for my game and i need to save the tilemap data (120×120 uint array) and character data (character type, position, rotation, stats, etc) to a .bin file. How can i do it? I know i can do it by using XMLs but it is not good for saving tilemaps… Thanks
Share
What you are looking for is the
FileReferenceclass’s save function. See here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html#save()This only works in Flash Player 10+, and requires user interaction. (It’ll pop up a save dialog box) These restrictions are there for security reasons, if you want to be able to save flies directly (without user interaction), you’ll have to use AIR, see the
FileStreamclass ref for that: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/FileStream.htmlTo save native Flash objects to an external file and load them in again, you’ll need to write the data to a
ByteArrayfirst.ByteArrayhas two methods (writeObject & readObject) that make this trivial. see here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/ByteArray.htmlGood luck.