Slider component » Value change event
Value change event
You can track the changes of a SliderComponent’s value
with an onValueChange
event.
Here’s an example. This slider’s max
is set to 100
(instead of the default 1
), and I use onValueChange
to update the label on the knob.
slider.onValueChange ->
# Update the value label on the knob
valueLabel.text = Utils.round this.value
I added a Text Layer as a child layer to the knob, and am updating its text
with the current value
of the slider (after passing it through ? Round to get a whole number).