Asset Packaging


#21

Can you make the music files smaller? What is the type of file you’re using for music?

For flash target I use all mp3, soundfx and music. For other targets I use ogg. I optimize in Audacity to make them small as I can with good quality, and if you don’t need stereo, convert them to mono and it’s basically half the size.

I tend to go with shorter music lengths, which also affects the file size.


#22

The music is ogg format. Not really sure making the music shorter is a valid option.


#23

If you write the files into bytes somewhere, then it should be possible to read them into memory and load that way. We (honestly) should do some sort of “asset.pak” solution built-into the Lime tools, but it just hasn’t been implemented yet. Most of the architecture is there for it, though

The “Buffer.add” issue is an error in the Haxe compiler, not expecting to embed quite so many haxe.Resource files


#24

What class do I need to be looking at to do byte conversions? I see the ByteArray class is, at the very least, what the Assets class loads in, but its not readily apparent how I would translate a music file to and from bytes.


#25

When you open a file (such as sys.io.File/loadBytes) it will be bytes already.

We also support static fromBytes or loadFromBytes methods for most asset types. For example, BitmapData.loadFromBytes


#26

Is there a (general purpose) tutorial I could refer to on working with bytes? Seriously, I’m a total green at working with them in higher-level languages.


#27

The ByteArray section of this tutorial might help: http://www.adobe.com/devnet/actionscript/learning/as3-fundamentals/vectors-and-bytearrays.html

Please feel free to ask any specific questions here :slight_smile:


#28

Ah, all right. Thanks again for the help. :slight_smile: