MACROMEDIA FLEX BUILDER-USING FLEX BUILDER Use Manual page 130

Table of Contents

Advertisement

Related topics
"Data binding in Flex" on page 150
Inserting a Flex data model into the MXML file
You can manually insert a Flex data model in an MXML file or you can visually import it.
To manually insert a data model into an MXML file:
Open the file in Code view (View > Code).
1.
Write an
2.
<mx:Model>
For example, the following data model stores a person's name, age, and phone number:
<mx:Model id="myEmployee">
<name>
<first>John</first>
<last>Doe</last>
</name>
<department>Accounting</department>
<email>jdoe@goodcompany.com</email>
</mx:Model>
For more information, see "Using data models" in Developing Flex Applications Help.
Save the file.
3.
Use the Data panel (Window > Data) to inspect the data model.
4.
Note: If the data model doesn't appear in the Data panel, click the refresh button on the panel.
To visually import a data model into an MXML file:
Open the file in Design or Code view.
1.
In the Data panel (Window > Data), click the Plus (+) button and select Model from the pop-
2.
up menu.
In the dialog that appears, enter the relative path and filename of the XML file, or click the
3.
Browse button and select the XML file.
This specifies the location of an XML file to use as a data model in the current MXML file.
After you click OK, Flex Builder inserts the data model in the file.
130
Chapter 6: Working with Data
tag.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex builder

Table of Contents