3
votes
<mx:Label id="myLabel" dataChange="{trace('changed!!');}"  />

I change the text in the above label:

myLabel.text = "new text";

But nothing is traced as it's supposed to.

Am I using a wrong event? I thought dataChange is fired when text in the label is changed.

1

1 Answers

2
votes

The event you want is valueCommit. The dataChange event is specific to the data property, not text.

<mx:Label id="myLabel" text="1" valueCommit="trace('changed')" />
<mx:Button label="Click Me" click="myLabel.text += '1'" />