The slider is similar to the progress bar, but the slider has a “button” button that allows the player to drag it to change the value of the progress bar.

Create slider

There are two ways to create a slider component.

Edit-mode properties

In the component editing state, the properties panel of the slider component is:


Instance properties

Select a slider component on the stage, and the property panel list on the right appears:


GSlider slider = gcom.GetChild("n1").asSlider;
slider.value = 50;

There are notification events when the slider progress changes:

slider.addEventListener(StateChangeEvent.CHANGED, onChanged);
slider.addEventListener(StateChangeEvent.CHANGED, this.onChanged, this);
slider.on(fairygui.Events.STATE_CHANGED, this, this.onChanged);
slider->addEventListener(UIEventType::Changed, CC_CALLBACK_1(AClass::onChanged, this));
slider.on(fgui.Event.STATUS_CHANGED, this.onChanged, this);