开发者

Saving several images (and metadata for each) in a single file using Adobe Air

开发者 https://www.devze.com 2023-01-07 07:28 出处:网络
Is it possible, via Adobe Air, to save multiple types of data in a single file? For example, an application would allow the user to load in external images, position them on stage and label them. This

Is it possible, via Adobe Air, to save multiple types of data in a single file? For example, an application would allow the user to load in external images, position them on stage and label them. This data would be then be stored in a ByteArray (I guess) using BitmapData for the images and probably XML for the metadata.

I would then like to write this to a single file, with a bespoke file extension that could be associated with said Air app.

开发者_开发技巧

I've asked this on various forums and never received a single reply.


You can add everything to a byte array and write it to file - but defining boundaries and extracting individual entities back from the file would take some effort. How about writing them to normal files, zipping them to a single file and deleting the originals? This way you can still have a single file and deal with the individual items more easily.

This article describes some ActionScript zip libraries. I've used nochump in the past and it was easy - this page has some sample code

If you want some individuality for your files, you can rename the zipped file to whatever extension you want - that's what Firefox extensions do, they have .xpi extension, but they're plain zip files renamed.

0

精彩评论

暂无评论...
验证码 换一张
取 消