For a simple button use a FlxButton
. You can call a function when clicked by the mouse.
// create a button that calls onButtonClick when its clicked
button = new FlxButton("Click me", onButtonClicked);
For a simple button use a FlxButton
. You can call a function when clicked by the mouse.
// create a button that calls onButtonClick when its clicked
button = new FlxButton("Click me", onButtonClicked);
package;
import flixel.FlxG;
import flixel.FlxState;
import flixel.ui.FlxButton;
import flixel.util.FlxColor;
class PlayState extends FlxState
{
override function create()
{
super.create();
var button = new FlxButton(0, 0, "Click me", onButtonClicked);
button.screenCenter();
add(button);
}
function onButtonClicked()
{
FlxG.camera.flash(FlxColor.WHITE, 0.33);
}
}