class flixel.addons.ui.FlxSlider extends FlxSpriteGroup

Available on all platforms

A slider GUI element for float and integer manipulation. * @author Gama11

Instance Fields

var body:FlxSprite

The horizontal line in the background.

var clickSound:String

Sound that's played whenever the slider is clicked.

var decimals:Int

How many decimals the variable can have at max. Default is zero, * or "only whole numbers".

var expectedPos:Float

The expected position of the handle based on the current variable value.

var handle:FlxSprite

The dragable handle - loadGraphic() to change its graphic.

var hoverAlpha:Float

The alpha value the slider uses when it's hovered over. 1 to turn the effect off.

var hoverSound:String

Sound that's played whenever the slider is hovered over.

var maxLabel:FlxText

The text under the right border - equals maxValue by default.

var maxValue:Float

Maximum value the variable can be changed to.

var minLabel:FlxText

The text under the left border - equals minValue by default.

var minValue:Float

Mininum value the variable can be changed to.

var nameLabel:FlxText

A text above the slider that displays its name.

var relativePos:Float

The position of the handle relative to the slider / max value.

var setVariable:Bool

Whether the slider sets the variable it tracks. Can be useful to deactivate this in conjunction with callbacks.

var value:Float

Stores the current value of the variable - updated each frame.

var valueLabel:FlxText

A text under the slider that displays the current value.

var varString:String

Stores the variable the slider controls.

function new(Object:Dynamic, VarString:String, ?X:Float = 0, ?Y:Float = 0, ?MinValue:Float = 0, ?MaxValue:Float = 10, ?Width:Int = 100, ?Height:Int = 15, ?Thickness:Int = 3, ?Color:Int = -16777216, ?HandleColor:Int = -8224126):Void

Creates a new FlxSlider. * *

Object

Reference to the parent object of the variable *

VarString

Variable that the slider controls *

X

x Position *

Y

y Position *

MinValue

Mininum value the variable can be changed to *

MaxValue

Maximum value the variable can be changed to *

Width

Width of the slider *

Height

Height of the slider *

Thickness

Thickness of the slider *

Color

Color of the slider background and all texts except for valueText showing the current value *

HandleColor

Color of the slider handle and the valueText showing the current value

function callback(:Float):Void

A function to be called when the slider was used. * The current relativePos is passed as an argument.

function destroy():Void

Cleaning up memory.

function setTexts(Name:String, ?Value:Bool = true, ?Min:String = null, ?Max:String = null, ?Size:Int = 8):Void

Handy function for changing the textfields. * *

Name

Text of nameLabel - null to hide *

Value

Whether to show the valueText or not *

Min

Text of minLabel - null to hide *

Max

Text of maxLabel - null to hide *

Size

Size to use for the texts

function update():Void