How do you remove the final character in a textfield?


#1

With AS3, I would have used this myTextField.text.slice(0, -1); in order to remove the last character in the textfield. How would I do this using HaXe/OpenFL? (Basically a hardcoded backspace feature.)


#2

This is one way.

myTextField.text = myTextField.text.substring(0, myTextField.text.length - 1);

http://api.openfl.org/String.html