PDA

View Full Version : [AS2] checking for a change event of TextInput component


skdzines
03-15-2009, 01:13 AM
Does anyone know how I can tell when the text of a TextInput component has changed? When the text changes I want to call a function to update another dynamic textfield however I can't seem to get it to trigger a change event. I have tried several different methods and none seem to work. Below is the last method I tried. By the way I'm using AS2 not AS3.

projMngrCS_qty.addEventListener("change", tiListener);

// Create listener object.
var tiListener:Object = new Object();

tiListener.change = function(evt_obj:Object) {
trace("Input has changed");
};

Any help is appreciated.

Thanks

magic77
04-28-2009, 02:45 PM
hi,

var tiListener:Object = new Object();

tiListener.change = function(eventObj:Object) {
var target = eventObj.target;
var targetID = eventObj.target.id;

// do something

};
myInputField.addEventListener("change", tiListener);

But TextInput Component should be on Stage already, and donīt forget to
import this before:

import mx.controls.TextInput;
import mx.core.UIComponent;