FlxButton
| Kind | class |
| Package | mobile.flixel |
| Full name | mobile.flixel.FlxButton |
| Source | source/mobile/flixel/FlxButton.hx |
| Extends | FlxTypedButton<FlxText> |
A simple button class that calls a function when clicked by the touch.
Public fields
| Name | Type | Static | Default | Notes |
|---|---|---|---|---|
NORMAL | Int | yes | 0 | Used with public variable status, means not highlighted or pressed. |
HIGHLIGHT | Int | yes | 1 | Used with public variable status, means highlighted (usually from touch over). |
PRESSED | Int | yes | 2 | Used with public variable status, means pressed (usually from touch click). |
text | String | no | — | property (get, set) · Shortcut to setting label.text |
bounds | FlxSprite | no | new FlxSprite() | A small invisible bounds used for colision |
Public methods
new (constructor)
function new(X:Float = 0, Y:Float = 0, ?Text:String, ?OnClick:Void->Void):Void
Creates a new FlxButton object with a gray background
and a callback function on the UI thread.
@param X The x position of the button. @param Y The y position of the button. @param Text The text that you want to appear on the button. @param OnClick The function to call whenever the button is clicked.
| Parameter | Type | Default |
|---|---|---|
X (optional) | Float | 0 |
Y (optional) | Float | 0 |
Text (optional) | String | — |
OnClick (optional) | Void->Void | — |
centerInBounds
inline function centerInBounds()
centerBounds
inline function centerBounds()
Internals
Private / internal members
| Method |
|---|
override function resetHelpers():Void |
inline function initLabel(Text:String):Void |
inline function get_text():String |
inline function set_text(Text:String):String |