Similarly, an Android game without any background music or sound effect won't keep the players long. Hence, it is important to know how to load audio/sound files into your game, playing them at a correct timing. Here, the codes for doing it with Starling Framework will be displayed.
1. Import Flash's Sound libraryIt is alright to just use the Sound library from the Flash. In fact, there isn't any specific library for the sound in Starling Framework.
2. Embed the audio/sound fileLike embedding the image files, embedding an audio/sound is similarly straightforward.
public const MOVE_SOUND:Class;
3. Define the sound variableHere, note that it is necessary to use "as Sound" when defining the variable.
public var sndMove:Sound = new MOVE_SOUND() as Sound;
4. Play the audio/sound fileWith the play function, you can directly play the audio file, with customizable parameters. (specify start time, loop times, sound transform)