Fork Heaps on GitHub


Heaps provides sound management. Heaps supports 3 different formats (WAV, MP3, OGG). The availability of the formats depend on the platform. You can determine which formats are supported using the following example:

    //Mp3 is available
    //Ogg format is available

Sounds can be included in your project by specificying them at compile time in your HXML file

-D resourcesPath="../relative/path/to/sound/folder/"

Once included in your project you can play a sound file via the file name of the sound you want to access.

//If your audio file is named 'my_music.mp3'

var musicResource:Sound = null;
//If we support mp3 we have our sound
    musicResource = hxd.Res.my_music;

if(musicResource != null){
    //Play the music and loop it;