On a flex project, I have a slider and text box on a form whereby I seek user input using either the slider(for ease) or the textinput(for precise numbers). Based on user input on either of these, I update the other via a listener attached, that calls the relevant functions
slider.addEventListener("change",sliderUpdate);
textIn.addEventListener("change",valueUpdate);
I am having problems with the textinput in that, it doesn’t allow me to key in a decimal number- this is probably happening as I have a listener that is incrementing the slider for every keystroke in textinput and hence unable to accept a “.”. e.g. .05, .1, .00003
How do I get around this- can i hold the textinput listener to holdoff till I can press an enter to indicate I am done?
This works for me:
The slider’s step value is 0.01; If you input a value in the text field the slider should automatically update.
EDIT:
Then on the TextInput you should listen for the keyDown event (KeyboardEvent.KEY_DOWN) and the function should check if the key pressed is ENTER and then update the slider:
The function:
If you prefer to use addEventListener the this should do it: