I want to have an onChange event fire whenever a user changes the value in a textInput control and tabs or mouses out of it. This is a very simple thing to do in HTML but I can't seem to find the equivalent in ActionScript 3.
Try either of these options:
//so you make your textField
var textField:TextField = new TextField();
//either use bindSetter to check on changes to the textfields text
BindingUtils.bindSetter(onChangeValue(),textField,"text");
//or add an eventlistener
textField.addEventListener(Event.CHANGE,onChangeValue());
I'm guessing that should work
let me know ![]()
good luck ![]()
Change event will be fired the moment I start typing. I am looking for an event to be fired only when the user changes the data and tabs out. focusIn and focus out will be fired irrespective of whether the user changed the data or not. I think we will have to write our own code to achieve this. This is a very fundamental requirement in any application, was wondering why flex doesn't support it.
I think the best answer here would be this:
var tfield:TextField = new TextField();
tfield.addEventListener(Event.CHANGE, tfieldChange);
function tfieldChange (evt:Event):void{
tfield.addEventListener(Event.focusOut, tfieldFocOut);
}
function tfieldFocOut (evt:Event):void{
doWhatEver();
tfield.removeEventListener(Event.focusOut, tfieldFocOut);
}
North America
Europe, Middle East and Africa
Asia Pacific