I need to change the trigger event for a validator so it
checks as soon as information is entered in a text area.
1. Currently I have to click on something else before the
Validator checks to see if anything is in the text area. I would
like it to check as soon as data is entered into the text area.
(like somehow linking it to the dataChange event of the text Area)
NB The Validator is attached to a custom component that is
dynamically created when the application is run.
2. I have a group of labels which change color based on the
validator when it is clicked on. Likewise each label only updates
when I click on another label and then click back on the original
label. I am somewhat new to Flex 2 so I am a bit confused about how
event listening works and how events can be handled.
My code follows below:
// Event listener for the valid and invalid events - in
isValid = true;
isValid = false;
a) use the triggerEvent="change" attribute of the Validator
so that the Validator is reevaluated after each key press (by
default the Validator is triggered by the source's "valueCommit"
event (which is only dispatched when focus leaves the TextInput)
b) create your own event handler for the TextInput's change
event and call the Validator's validate() method programatically
from your handler