MACROMEDIA FLEX BUILDER-USING FLEX BUILDER Use Manual page 151

Table of Contents

Advertisement

The following example binds the text property of a TextInput component (the source property) to
the text property of a Label component (the destination property) so that text entered in the
TextInput component is displayed by the Label component:
<mx:TextInput id="LNameInput"></mx:TextInput>
...
<mx:Label text="{LNameInput.text}"></mx:Label>
Flex Builder binds data with the curly braces syntax. To understand this syntax, see "Binding data
with the curly braces syntax" in Developing Flex Applications Help. If you hand-code your pages,
you can also use the
with the <mx:Binding> tag" in Developing Flex Applications Help.
Related topics
"Binding data" in Developing Flex Applications Help
"Flex data services" on page 152
"Working with Flex data services" on page 136
"Binding a control or container" on page 127
"Working with Flex data models" on page 129
Flex data models
A data model is an object you can use to temporarily store data in memory so that you can more
easily manipulate the data. For example, a data model could store information such as a person's
name, age, and phone number, as follows:
<mx:Model id="myEmployee">
<name>
<first>John</first>
<last>Doe</last>
</name>
<department>Accounting</department>
<email>jdoe@goodcompany.com</email>
</mx:Model>
The fields of a data model can contain static data as above, or they can be bound to other objects.
This binding allows you to pass data to and from the data model.
You can also define the data model in a separate XML file or a URL that returns XML. In that
case, you can use the
web application directory, or to specify the HTTP URL that returns XML.
In the following examples, the content of the myContacts data model is an XML file named
content.xml stored in the same folder as the MXML file. The content of the myCompany data
model is a fictional HTTP URL that returns XML:
<mx:Model source="content.xml" id="myContacts"/>
<mx:Model source="http://www.somesite.com/companyinfo.xml" id="myCompany"/>
tag to bind data. For more information, see "Binding data
<mx:Binding>
property in the
source
tag to specify the XML file in the local
<mx:Model>
About Flex data bindings
151

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex builder

Table of Contents