Question

I have the following element:

<mx:TextInput x="60" y="100" width="467.95" id="Tx_Cotista" change="Change()"/>

And I want to every time that the value is changed, the function Change() be called. But this do not work when the value is changed by the actionscript.

Am I doing something wrong? (when the value is typed it works very well)

Whether I'm correct, is there some alternative?

Was it helpful?

Solution

If you want to execute an event every time that the text property of the TextInput is changed, then you can do so by listening to the textChanged event. This is an internal event used for binding and is probably not defined in the ASDocs or wtih event metadata. That means you can't listen for it in MXML.

In ActionScript, try this:

Tx_Cotista.addEventListener('textChanged',Change())

You'll probably want to remove the change event listener defined in MXML, or the Change() method may get executed twice.

Your original question said

i want to every time that the value is changed

But, you didn't specify what "The value" is. If you are referring to a value other than the text property, then you can use the same approach I describe above; just replace 'text' with the public property you care about.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top