User Guide

Data binding classes (Flash Professional only) 235
You can also use the methods of the DataType class to get or set fields in various data types. The
DataType class automatically converts the raw data to the requested type, if possible. For example,
in the code example above, the data that’s retrieved is converted to the String type, even if the raw
data is a different type.
The
ComponentMixins.getField() method is available for components that have been
included in a data binding (either as a source, destination, or an index), or that have been
initialized with
ComponentMixins.initComponent(). For more information, see
“ComponentMixins class (Flash Professional only)” on page 229.
Note: To make this class available at runtime, you must include the data binding classes in your FLA
document.
For an overview of the classes in the mx.data.binding package, see “Classes in the mx.data.binding
package (Flash Professional only)” on page 213.
Method summary for the DataType class
The following table lists the methods of the DataType class.
Property summary for the DataType class
The following table lists the properties of the DataType class.
Method Description
DataType.getAnyTypedValue() Fetches the current value of the field.
DataType.getAsBoolean() Fetches the current value of the field as a Boolean value.
DataType.getAsNumber() Fetches the current value of the field as a number.
DataType.getAsString() Fetches the current value of the field as a String value.
DataType.getTypedValue() Fetches the current value of the field in the form of the requested
data type.
DataType.setAnyTypedValue() Sets a new value in the field.
DataType.setAsBoolean() Sets the field to the new value, which is given as a Boolean value.
DataType.setAsNumber() Sets the field to the new value, which is given as a number.
DataType.setAsString() Sets the field to the new value, which is given as a string.
DataType.setTypedValue() Sets a new value in the field.
Property Description
DataType.encoder Provides a reference to the encoder object associated with this field.
DataType.formatter Provides a reference to the formatter object associated with
this field.
DataType.kind Provides a reference to the Kind object associated with this field.