Skip to main content

FlxButton

Kindclass
Packagemobile.flixel
Full namemobile.flixel.FlxButton
Sourcesource/mobile/flixel/FlxButton.hx
ExtendsFlxTypedButton<FlxText>

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

Public fields​

NameTypeStaticDefaultNotes
NORMALIntyes0Used with public variable status, means not highlighted or pressed.
HIGHLIGHTIntyes1Used with public variable status, means highlighted (usually from touch over).
PRESSEDIntyes2Used with public variable status, means pressed (usually from touch click).
textStringno—property (get, set) · Shortcut to setting label.text
boundsFlxSpritenonew 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.

ParameterTypeDefault
X (optional)Float0
Y (optional)Float0
Text (optional)String—
OnClick (optional)Void->Void—

View source

centerInBounds​

inline function centerInBounds()

View source

centerBounds​

inline function centerBounds()

View source

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