Language Version : | ActionScript 3.0 |
Runtime Versions : | Flash Player 9, AIR 1.1 |
The ZipCodeFormatter class formats a valid number
into one of the following formats, based on a
user-supplied
formatString
property.
- #####-####
- ##### ####
- #####
- ### ### (Canadian)
A six-digit number must be supplied for a six-digit mask.
If you use a five-digit or a nine-digit mask, you can use
either a five-digit or a nine-digit number for formatting.
If an error occurs, an empty String is returned and a String that
describes the error is saved to the error
property.
The error
property can have one of the following values:
-
"Invalid value"
means an invalid numeric value is passed
to the format()
method. The value should be a valid number
in the form of a Number or a String, except for Canadian postal code,
which allows alphanumeric values, or the number of digits does not match
the allowed digits from the formatString
property.
-
"Invalid format"
means any of the characters in the
formatString
property do not match the allowed characters
specified in the validFormatChars
property,
or the number of numeric placeholders does not equal 9, 5, or 6.
Show MXML Syntax
Hide MXML Syntax
The <mx:ZipCodeFormatter>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:ZipCodeFormatter
formatString="#####|#####-####|### ###"
/>
formatString:String
Language Version : | ActionScript 3.0 |
Runtime Versions : | Flash Player 9, AIR 1.1 |
The mask pattern.
Possible values are "#####-####"
,
"##### ####"
, "#####"
,
"###-###"
and "### ###"
.
The default value is "#####"
.
Implementation public function get formatString():String
public function set formatString(value:String):void
public function ZipCodeFormatter()
Language Version : | ActionScript 3.0 |
Runtime Versions : | Flash Player 9, AIR 1.1 |
Constructor.
override public function format(value:Object):String
Language Version : | ActionScript 3.0 |
Runtime Versions : | Flash Player 9, AIR 1.1 |
Formats the String by using the specified format.
If the value cannot be formatted, return an empty String
and write a description of the error to the error
property.
Parameters
| value:Object — Value to format.
|
Returns | String — Formatted String. Empty if an error occurs. A description
of the error condition is written to the error property.
|
Mon Jul 9 2012, 07:18 PM -04:00