A simple button class that calls a function when clicked by the mouse.

Constructor

@:value({ Y : 0, X : 0 })new(X:Float = 0, Y:Float = 0, ?Label:FlxSprite, ?OnClick:() ‑> Void)

Creates a new FlxButton object with a gray background and a callback function on the UI thread.

Parameters:

X

The x position of the button.

Y

The y position of the button.

Text

The text that you want to appear on the button.

OnClick

The function to call whenever the button is clicked.

Methods

@:value({ align : "center", color : 0x333333, size : 8 })createTextLabel(Text:String, ?font:String, size:Int = 8, color:Int = 0x333333, align:String = "center"):FlxSpriteButton

Generates text graphic for button's label.

Parameters:

Text

text for button's label

font

font name for button's label

size

font size for button's label

color

text color for button's label

align

text align for button's label

Returns:

this button with generated text graphic.