FlxG
provides a way of playing sounds, should you not feel like initiating a FlxSound instance.
// Play a sound FlxG.sound.play();
FlxG
provides a way of playing sounds, should you not feel like initiating a FlxSound instance.
// Play a sound FlxG.sound.play();
package; import flixel.FlxG; import flixel.FlxSprite; import flixel.FlxState; import flixel.math.FlxMath; import flixel.text.FlxText; import flixel.ui.FlxButton; class PlayState extends FlxState { override public function create() { super.create(); var soundBox:FlxButton = new FlxButton(0, 0, "Play Sound", playSound); soundBox.screenCenter(); add(soundBox); } function playSound() { FlxG.sound.play("assets/just-a-breath.mp3"); } }