User Guide

270 Chapter 14: Data Integration (Flash Professional Only)
To use a dynamic value for the Bound To property:
1.
Select a component in the Component Path pane.
2.
Do one of the following actions to select a schema item for the data:
Select a schema item using the Schema tree located within the Schema Location pane.
Select Use Path Expression, select a component property from the schema tree, and enter a
path expression. For more information, see Adding bindings using path expressions
on page 302.
To use a constant value for the Bound To property:
Select Use Constant Value, and enter a constant value, such as 3, a string, or true. You can use
any value that is valid for the schema item. When you use a constant value, the selected
component path, schema location, and path expression are ignored. You can bind to a constant
value only when the Direction attribute for the binding is set to In.
Creating an indexed binding
In the example application created in “Creating a simple application” on page 256, the data grid
displays the dinner menu. The description of each food item, however, is too long to fit in the
data grid. Ideally, the user could click an item in the data grid and read the full description of a
food item, perhaps in a text box below the data grid. To accomplish this, you would create an
indexed binding to the data array.
This section shows you how to create an indexed binding to connect a field in your data source
with the selected index of another component. The most common use for an indexed binding is
to the
selectedIndex property of a UI element. When you create a binding to the index of an
array, a setting for its value is dynamically added to the Schema Attributes pane; you use this
setting, the
Index for field, to specify to what to bind the index.
Note: If a schema item location includes several array references such as "foo/bar[]/abc[]/def[]",
three index for settings are dynamically added to the Schema Attributes pane—one for each array
that needs to be indexed.
In the following example, you add a text box to display the full description of the food item when
a user clicks on the item in the data grid.
To create an indexed binding:
1.
If you haven’t already done so, create the example application shown in “Creating a simple
application” on page 256.
2.
Drag a TextArea component to the Stage and name it myTextArea.