Open the Timeline and select the first frame on Layer 1.
18.
Open the Actions panel.
19.
Add the following code to the Actions panel:
20.
function dataIsInvalid(evt) {
if (evt.property == "text") {
status.text = evt.messages;
}
}
function dataIsValid(evt) {
if (evt.property == "text") {
status.text = "OK";
}
}
textLabel.addEventListener("valid", dataIsValid);
textLabel.addEventListener("invalid", dataIsInvalid);
Save the FLA file as OddOnly.fla to the same folder that contains OddNumbersOnly.as.
21.
Test the SWF file (Control > Test Movie).
22.
Click the arrows on the NumericStepper component to change its value. Notice the message
that appears in the TextArea component when you choose even and odd numbers.
CustomValidator.validationError()
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX Professional 2004.
Usage
this.validationError(errorMessage)
Note: This method can be invoked only from within a custom validator class; the keyword
to the current CustomValidator object.
Parameters
errorMessage
Returns
Nothing.
Description
Method; called from the
validation errors. If you don't call
finishes executing. If you call
validate()
the
validate()
A string that contains the error message to be reported.
validate()
validationError()
, an
event is generated after
invalid
method of your subclass of CustomValidator to report
, a
valid
validationError()
validate()
Data binding classes (Flash Professional only)
event is generated when
one or more times from within
returns.
refers
this
223
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?