문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top