MACROMEDIA FLEX BUILDER-USING FLEX BUILDER Use Manual page 131

Table of Contents

Advertisement

Use the Data panel to inspect the data model.
4.
You could also hand-code an
or a URL that returns XML. The following are some examples:
<mx:Model source="content.xml" id="contact"/>
<mx:Model source="http://www.somesite.com/content.xml" id="company"/>
Note: If you create a data model with the source property, you will be unable to visually create a
binding to the model because the binding destination is in an external file.
Binding a Flex data model to an object
After inserting a Flex data model in the MXML file, you can bind it to an object in the file.
You create one binding to retrieve data from a data model and a separate binding to pass data to a
data model. The procedures in this section describe how to create each type of binding.
This section covers the following topics:
"Retrieving data from a Flex data model" on page 131
"Passing data to a Flex data model" on page 134
Retrieving data from a Flex data model
You can create bindings that retrieve data from data models. For example, you can create a
binding that retrieves employee information from a data model so that you can display the
information in your MXML file.
To create a binding that retrieves data from a data model:
Make sure your MXML file contains a component, data model, or data service that can accept
1.
the data from the data model.
For example, your file can have a Label component that will display an employee name
received from the data model.
In the Data panel, select the data model.
2.
In the Bindings panel (Window > Bindings), click the Plus (+) button.
3.
The Add Binding - Step 1 dialog box appears.
tag with a
<mx:Model>
property that specifies an XML file
source
Working with Flex data models
131

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex builder

Table of Contents