MACROMEDIA FLASH MX 2004-USING FLASH Use Manual page 297

Hide thumbs Also See for FLASH MX 2004-USING FLASH:
Table of Contents

Advertisement

You can create custom encoders. The number of encoders allowed is unlimited. Encoders are
defined by XML files found in the Flash MX Professional 2004 Configuration/Encoders folder.
The definition includes the following metadata:
An ActionScript class that will be instantiated to encode/decode the data. This class must be a
subclass of mx.databinding.DataAccessor.
An Encoder Options dialog box
Schema formatters
A formatter is an object that performs bidirectional conversion of data between a raw data type
and string data. The object has parameters that are settable during authoring and runtime
methods for performing the conversion. The following formatters come with Flash MX
Professional 2004:
None
The default formatter. No formatting is performed.
Boolean
This formatter formats a Boolean value as a string. You can set up Boolean options for
strings that mean
true
Compose String
format using a string template. The template is arbitrary text that can refer to the data fields in
one of the following ways:
<field-name>
<field-name.field-name>
, which represents the entire object. This can be used, for example, when the original object
<.>
is a string, in which case
Here are two examples using the Compose String formatter. A formatter could be applied to a
field that is an object with field name, quantity, and price, and the string output could read:
ordered <quantity> units of <name> at <$price> each.
formatter could be applied to a field that is a number, and you could define the string output to
read:
"You have <.> messages."
Custom Formatter
name. The formatter ActionScript class should have the following format:
class MyFormatter extends mx.data.binding.CustomFormatter {
// convert a raw value, returns a formatted value
function format(rawValue){
}
// convert a formatted value, returns a raw value
function unformat(formattedValue){
}
}
Rearrange Fields
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.
(for example, 1, yes) and strings that mean
This formatter converts a data object to a string. You define the output
, using dots to drill down into the data structure
is simply the value of the string.
<.>
This formatter lets you specify a custom formatter by specifying a class
This formatter creates a new array of objects based on the original array in
(for example, 0, no).
false
" In another example, the
Advanced topics in data integration
"You
297

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents