CustomFormatter class (Flash Professional only)

ActionScript Class Name mx.data.binding.CustomFormatter

The CustomFormatter class defines two methods, format() and unformat(), that provide the ability to transform data values from a specific data type to String, and vice versa. By default, these methods do nothing; you must implement them in a subclass of mx.data.binding.CustomFormatter.

To create your own custom formatter, you first create a subclass of CustomFormatter that implements format() and unformat() methods. You can then assign that class to a binding between components either by creating a new Binding object with ActionScript (see Binding class (Flash Professional only)), or by using the Bindings tab in the Component inspector. For information on assigning a formatter class using the Component inspector, see Schema formatters in Using Flash.

You can also assign a formatter class to a component property on the Schema tab of the Component inspector. However, in that case, the formatter is used only when the data is needed in the form of a string. In contrast, formatters assigned with the Bindings panel, or created with ActionScript, are used whenever when the binding is executed.

For an example of writing and assigning a custom formatter using ActionScript, see Sample custom formatter.

NOTE

 

To make this class available at runtime, you must include the data binding classes in your FLA file. For more information, see Making data binding classes available at runtime (Flash Professional only).

For an overview of the classes in the mx.data.binding package, see Classes in the mx.data.binding package (Flash Professional only).


Version 8

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00003207.html