how to handle space-bar in taking input from user in a string.my code is
btnSearch.addEventListener(MouseEvent.CLICK, getData);
function getData(event:MouseEvent)
{
var input:String = textfieldName.text;
if((input != null)&&(input.length != 0)&&(input != ""))
{
func(input);
}
}
when user hits backspace, func is called and input string length increased as many times as the spacebar is clicked.
what you have to di first is to validate the input, e.g. you can trim all white space (you could also do it on the textfield e.g. by applying the allowed characters to the restrict property
to strip in your getData handler you could do as follows:
placed after you read the input value from textfield.
best regards