Is there a way to "lock" a slider widget at a fixed value?

I have a screen where the user can set the size, weight etc of a character using sliders. These values can only be set at creation.

I reuse the same scene however to allow the player to view the characters stats. In this screen I still want to display the slider so the player can see their original setting, but I don’t want them to be able to move them.

I’ve tried putting this into the slider listener but it had no effect:

event.target.value = originalValue 

Is there any way to set the slider’s value manually, other than at the point of creation?

This might seem like a strange thing to need given that it is called a slider and not a stayer but (for me at least) it would be very handy.

My only alternative is to manually create a second slider object which is just the slider line and dot but with no touch listener, and render that instead of the original slider.

Hi @AIanPlantPot,

I haven’t experimented with this, but what happens if you omit the listener function definition from the slider declaration? I assume the slider still functions, but you don’t get any “response” to it?

Another potential idea is to place a touch-capturing object/group over the slider(s) you want to prevent touch on… i.e. just an invisible rectangle with .isHitTestable on it, and that object has a touch/tap listener which essentially just returns true (so does nothing) while preventing touch propagation from going through to the sliders. Would that possibly work for you?

Best regards,

Brent

Hi @AIanPlantPot,

I haven’t experimented with this, but what happens if you omit the listener function definition from the slider declaration? I assume the slider still functions, but you don’t get any “response” to it?

Another potential idea is to place a touch-capturing object/group over the slider(s) you want to prevent touch on… i.e. just an invisible rectangle with .isHitTestable on it, and that object has a touch/tap listener which essentially just returns true (so does nothing) while preventing touch propagation from going through to the sliders. Would that possibly work for you?

Best regards,

Brent