Packagemx.formatters
Classpublic class Formatter
SubclassesNumberFormatter

The Formatter class is the base class for all data formatters. Any subclass of Formatter must override the format() method.

MXML Syntaxexpanded Hide MXML Syntax

The Formatter class defines the following tag attributes, which all of its subclasses inherit:

  <mx:tagname
    Properties
    error=""
  />
  


Public Properties
 PropertyDefined by
  defaultInvalidFormatError : String
[static] Error message for an invalid format string specified to the formatter.
Formatter
  defaultInvalidValueError : String
[static] Error messages for an invalid value specified to the formatter.
Formatter
  error : String
Description saved by the formatter when an error occurs.
Formatter
Public Methods
 MethodDefined by
  
Constructor.
Formatter
  
format(value:Object):String
Formats a value and returns a String containing the new, formatted, value.
Formatter
Protected Methods
 MethodDefined by
  
This method is called when a Formatter is constructed, and again whenever the ResourceManager dispatches a "change" Event to indicate that the localized resources have changed in some way.
Formatter
Property detail
defaultInvalidFormatErrorproperty
defaultInvalidFormatError:String  [read-write]

Error message for an invalid format string specified to the formatter.

The default value is "Invalid format".

Implementation
    public static function get defaultInvalidFormatError():String
    public function set defaultInvalidFormatError(value:String):void
defaultInvalidValueErrorproperty 
defaultInvalidValueError:String  [read-write]

Error messages for an invalid value specified to the formatter.

The default value is "Invalid value".

Implementation
    public static function get defaultInvalidValueError():String
    public function set defaultInvalidValueError(value:String):void
errorproperty 
public var error:String

Description saved by the formatter when an error occurs. For the possible values of this property, see the description of each formatter.

Subclasses must set this value in the format() method.

Constructor detail
Formatter()constructor
public function Formatter()

Constructor.

Method detail
format()method
public function format(value:Object):String

Formats a value and returns a String containing the new, formatted, value. All subclasses must override this method to implement the formatter.

Parameters
value:Object — Value to be formatted.

Returns
String — The formatted string.
resourcesChanged()method 
protected function resourcesChanged():void

This method is called when a Formatter is constructed, and again whenever the ResourceManager dispatches a "change" Event to indicate that the localized resources have changed in some way.

This event will be dispatched when you set the ResourceManager's localeChain property, when a resource module has finished loading, and when you call the ResourceManager's update() method.

Subclasses should override this method and, after calling super.resourcesChanged(), do whatever is appropriate in response to having new resource values.