IN THIS CHAPTER
<fx:Model> tag to model data items
Embedding data with
Creating value object classes in ActionScript
Storing data sets in client memory with the
Filtering and sorting data with the
Traversing, searching, and bookmarking data objects with the
Flex applications are stateful; that is, they have the capability to remember data persistently for the duration of the user's session in a way that classic Web applications usually don't. One of the most common tasks you must accomplish as an application developer is to create a framework for storing data that the application can use at runtime.
The content of an application's data can come from many sources: XML files, databases or other server-side resources, or remote functions wrapped by and exposed as SOAP-style or Representational State Transfer (REST)-style Web services. Regardless of how the data comes to an application, though, a Flex application stores the data in exactly the same way: as a data model.
In this chapter, I describe common techniques for modeling data in Flex applications. I start with creating single-object data models: ActionScript classes designed to hold one instance of a data entity at a time. (A data instance might represent a row in a database table or a single element in an XML file.) You can represent such data instances with the
<fx:Model> tag, a generic data object, ...