You define your data models using MXML or ActionScript as part of a Flex application. The
following figure shows a form created in Flex that uses a data model:
Data binding is the process of tying the data in one object to another object. The data model
supports bidirectional data binding for writing data from Flex controls to the data model, or for
reading data into controls from the model. You can also bind server data to a data model or
directly to Flex controls. For example, you can bind the results returned from a web service to the
data model, and then have that data propagate to your form controls.
The data model supports automatic data validation. This means that you can use the Flex
ZipCode validator to make sure that the value in a model field is a valid ZIP code. If the data is
invalid, you can display a message to the user so that the user can correct the error.
How Flex fits the MVC models
The goal of the Model-View-Controller (MVC) architecture is that by creating components with
a well-defined and limited scope in your application, you increase the reusability of the
components and improve the maintainability of the overall system. Using the MVC architecture,
you can partition your system into three categories of components:
Model components
View components
Controller components
For example, with the MVC design, you could implement a data-entry form that has three
distinct pieces:
•
The model consists of XML data files or the remote data service calls to hold the form data.
•
The view is the presentation of any data and display of all user interface elements.
•
The controller holds the user interface logic.
Encapsulates data and behaviors related to the data.
Defines your application's user interface.
Handles the data interconnectivity in your application.
Data model
HTTP/SOAP/AMF
Developing applications
Server
13
Need help?
Do you have a question about the FLEX-GETTING STARTED WITH FLEX and is the answer not in the manual?
Questions and answers