class flixel.addons.ui.FlxButtonPlus extends FlxSpriteGroup
Available on all platforms
A simple button class that calls a function when clicked by the mouse. * * @link http://www.photonstorm.com * @author Richard Davey / Photon Storm
Class Fields
Instance Fields
function new(?X:Float = 0, ?Y:Float = 0, ?Callback:Void ->Void = null, ?Label:String = null, ?Width:Int = 100, ?Height:Int = 20):Void
Creates a new FlxButton object with a gray background * and a callback function on the UI thread. * *
X | The X position of the button. * |
Y | The Y position of the button. * |
Callback | The function to call whenever the button is clicked. * |
Label | Text to display on the button * |
Width | The width of the button. * |
Height | The height of the button. |
WARNING: This will remove this object entirely. Use kill() if you * want to disable it temporarily only and reset() it later to revive it. * Called by the game state when state is changed (if this object belongs to the state)
function leaveCallback():Void
This function is called when the mouse leaves a hovered button (but didn't click)
function loadButtonGraphic(Normal:FlxSprite, Highlight:FlxSprite):Void
If you wish to replace the two buttons (normal and hovered-over) with FlxSprites, then pass them here. * Note: The pixel data is extract from the passed FlxSprites and assigned locally, it doesn't actually use the sprites * or keep a reference to them. * *
Normal | The FlxSprite to use when the button is in-active (not hovered over) * |
Highlight | The FlxSprite to use when the button is hovered-over by the mouse |
function updateActiveButtonColors(Colors:Array<Int>):Void
If you want to change the color of this button in its active (hovered over) state, then pass a new array of color values
function updateInactiveButtonColors(Colors:Array<Int>):Void
If you want to change the color of this button in its in-active (not hovered over) state, then pass a new array of color values