Advanced topics in data integration 441
Rearrange Fields This formatter creates a new array of objects based on the original array
in your binding. It can only be applied to fields that are arrays. You define the fields on the
new array by using a string template in the form:
fieldname1=definition1;fieldname2=definition2;and so on.
The fieldnameN are the names of the fields in the new array or records. The definitionN is
one of the following:
■ The name of a field in the original record
■ A string, enclosed in single quotes ('), that contains a mix of text and tags. A tag is the
name of a field in the original array, enclosed in < and >.
■ A single dot (.), which represents the entire original record
For example, suppose you want to assign an array to the
DataProvider property of a List
component using data binding. The objects within the array do not have a
label property
(which the list uses if available). You could use this formatter to create a new array through
data binding that replicates the objects within your original array and adds a
label property
to each object using the values you define. The following template would achieve this (this
would be on a binding between your array and the List component’s
DataProvider
property):
label='My name is <firstName> <lastName>;'
firstName=firstName;
lastName=lastName;
This syntax assumes that the object has two properties, called firstName and lastName. The
label property will be added to each object within the new array.
Number Formatter This formatter allows you to specify the number of fractional digits
that appears when a number is converted to text.
You can create custom formatters. The number of formatters allowed is unlimited. Formatters
are defined by XML files found in the Flash Professional 8 Configuration/Formatters folder.
The definition includes the following metadata:
■ The ActionScript class that will be instantiated to perform the formatting
■ A Formatter Options dialog box
NOTE
This formatter can be used on any binding from a component property that is of the
Array type to another component property of the Array type. Also note that the
Rearrange Fields formatter doesn’t work if you access if in the Schema panel, but does
work if you access it in the Bindings panel.