MACROMEDIA FLASH 8-USING FLASH Use Manual page 402

Using flash
Table of Contents

Advertisement

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
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
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
402
Data Integration (Flash Professional Only)
When you want to set data into a component, data binding first
, which is equivalent
none
"Schema item settings" on page
431.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-USING FLASH and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF