Creating a custom formatter
You create a custom formatter by creating a class that extends the
mx.formatters.Formatter
base class, or by creating a class that extends one of the standard formatter classes, which all
extend mx.formatters.Formatter. The following example shows the class hierarchy for
formatters:
Formatter
all formatter classes
Like standard formatter classes, your custom formatter class must contain a public
format()
method that takes a single argument and returns a String that contains the formatted data.
Most of the processing of your custom formatter occurs within the
method.
format()
Your custom formatter also might let the user specify which pattern formats the data. Where
applicable, the Flex formatters, such as the ZipCodeFormatter, use a
property
formatString
to pass a format pattern. Some Flex formatters, such as the NumberFormatter and
CurrencyFormatter classes, do not have
properties, because they use a set of
formatString
properties to configure formatting.
208
Creating Custom Formatters
Need help?
Do you have a question about the FLEX 2 - CREATING AND EXTENDING COMPONENTS and is the answer not in the manual?
Questions and answers