User Guide
74 Chapter 4: Architecting Flex Applications
Flex Store component figure
The following figure shows the component type of each object in the object model of the Flex
Store application. The Data Object boxes show which objects contain data object properties.
FlexStore
The FlexStore object, the top-level application object, is an MXML file. It contains standard
MXML tags that declare most of the application, and custom MXML tags that declare custom
objects. For the custom tags, this file declares them to use the default namespace.
The FlexStore object also contains some application-level ActionScript code that helps glue the
application together, and Cascading Style Sheet (CSS) definitions. The ActionScript code and
CSS definitions are contained in external files to promote modularity and reusability.
catalog
The catalog object is declared in an <mx:Model> tag in the FlexStore.mxml file because it is a
simple object with the sole function of data storage, and it requires no data typing. Compare this
with the ShoppingCart object, which is also in the model tier, but stores and manipulates data.
The data for the catalog object is defined in an external XML file, catalog.xml, which is accessed
using a named web service and the following
<mx:WebService> data service tag:
<mx:WebService id="catalogWS" serviceName="FlexStoreCatalogWS">
<mx:operation
name="getList"
result="selectedItem=catalogWS.getList.result[0]"
/>
</mx:WebService>
Data could just as easily be accessed using an HTTP service or a server-side Java object that
retrieves data from a remote data source.
ShoppingCart
(ActionScript component)
Model
CartView
(MXML component)
View
ProductThumbnail
(MXML component)
View
Thumbnail
(MXML component)
View
ShoppingCart
(MXML component)
View
ProductDetail
(MXML component)
View
catalog
<mx:Model> tag
Model
FlexStore
(MXML Application
object)
View
cartData
variable of type
ShoppingCart
Data Object
dataObject
variable
Data Object
cartData
variable of type
ShoppingCart
Data Object
dataObject
variable
Data Object
dataObject
variable
Data Object