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 library
It 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.import flash.media.Sound;
2. Embed the audio/sound file
Like embedding the image files, embedding an audio/sound is similarly straightforward.[Embed(source="../media/sounds/move.mp3")]
public const MOVE_SOUND:Class;
3. Define the sound variable
Here, 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 file
With the play function, you can directly play the audio file, with customizable parameters. (specify start time, loop times, sound transform)sndMove.play()
Alternatively, you could load the sounds into Starling's Asset Manager and play the sounds directly from there.
ReplyDeleteYou are right. In fact, loading into Starling's Asset Manager is more efficient and manage-able.
Deletethanks for sharing this article. i like it and very informan
ReplyDeleteFirstlagu
Stafaband
vialagu
Nella Kharisma Tresno Mergo Bondo Mp3
Nella Kharisma Biar Kucari Jalanku Mp3
Hanin Dhiya Akad (Cover Payung Teduh) Mp3
Nella Kharisma Tresno Mergo Bondo Mp3
Taylor Swift Look What You Made Me Do Mp3
Nella Kharisma Terminal Giwangan Terbaru