402
Data Integration (Flash Professional Only)
Encoder
The encoder’s job is to convert this data to an ActionScript data type. For
example, the string data that you get from an XML document can represent a date or a
number. If data binding needs the data in string form (because it is being assigned to a text
component, for example) the formatter does this conversion. If there are several
bindings from a field, the formatter is used only for those bindings that are assigning to a field
whose type is String.
Data type and formatter
When you want to set data into a component, data binding first
needs to convert the data to an ActionScript data type, which is a form that the component
can read; this conversion is automatic, depending on the Data Type setting. If the data is a
string and a Formatter setting exists, then the formatter converts the data from string to the
specified ActionScript data type. The Data Type setting also controls whether the data
binding engine inspects the data to see if it’s valid and causes events to be generated
accordingly. The encoder then converts the data from the ActionScript-readable form to raw
form, and the kind then finally passes the data to the component.
The processing handled by these four attributes occurs when the data field is accessed with
data binding. It is possible to directly access a component property from your ActionScript
code, but when you do this, you’re working with the raw value of the data, not the data value
that results from the action of data types, encoders, formatters, and kinds. For more
information, see the “DataType class (Flash Professional only)” in the
Components Language
Reference
.
In many cases, you won’t need to edit the settings that are in the bottom pane of the Schema
tab. The following guidelines specify when to change the schema item settings from their
default values:
■
You always need a kind. The default value for the kind setting is
none
, which is equivalent
to the Data kind.
■
You need an encoder when the component does not provide the data in the form you
want. The most common case is the XMLConnector component, or any other
component whose properties are XML data. This is because XML stores all data—
including numbers, dates, and Boolean values—as strings. If you want to use the actual
data instead of its string representation, you use an encoder.
■
You need a formatter when you want to control how the data is converted to a string,
usually for display purposes.
■
You need a data type when you want data validation to occur, you want better conversion
for certain data types, or both.
For more information on these schema item settings, see
“Schema item settings” on page 431
.
Summary of Contents for FLASH 8-FLASH
Page 1: ...Using Flash ...
Page 12: ...12 Contents ...
Page 110: ...110 Using Symbols Instances and Library Assets ...
Page 128: ...128 Working with Color Strokes and Fills ...
Page 156: ...156 Drawing ...
Page 190: ...190 Working with Text ...
Page 224: ...224 Working with Graphic Objects ...
Page 270: ...270 Creating Motion ...
Page 310: ...310 Working with Video ...
Page 362: ...362 Working with Screens Flash Professional Only ...
Page 386: ...386 Creating Multilanguage Text ...
Page 454: ...454 Data Integration Flash Professional Only ...
Page 500: ...500 Publishing ...
Page 534: ...534 Creating Accessible Content ...