Customvalidator.validate() - MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference

Components language reference
Table of Contents

Advertisement

CustomValidator.validate()

Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX Professional 2004.
Usage
This method is called automatically; you don't invoke it directly.
Parameters
The data to be validated; it can be of any type.
value
Returns
Nothing.
Description
Method; called automatically to validate the data contained by the
parameter. You
value
must implement this method in your subclass of CustomValidator; the default
implementation does nothing.
You can use any ActionScript code to examine and validate the data. If the data is not valid,
this method should call
with an appropriate message. You can call
this.validationError()
more than once if there are several validation problems with
this.validationError()
the data.
Since
might be called repeatedly, avoid adding code that takes a long time to
validate()
complete. Your implementation of this method should only check for validity, and then report
any errors using
. Similarly, your implementation
CustomValidator.validationError()
should not take any action as a result of the validation test, such as alerting the end user.
Instead, create event listeners for
and
events and alert the end user from those
valid
invalid
event listeners (see the example below).
Example
The following procedure demonstrates how to create and use a custom validator class. The
method of the CustomValidator class OddNumbersOnly.as determines any
validate()
value that is not an odd number to be invalid. The validation occurs whenever a change
occurs in the value of a NumericStepper component, which is bound to the
property of
text
a Label component.
CustomValidator.validate()
217

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash 8

Table of Contents