User Guide
Architecting an application 75
The following example shows the catalog object declared in the FlexStore.mxml file:
<mx:Model id="catalog">
{catalogWS.getList.result}
</mx:Model>
The following example shows a product definition in the catalog.xml file:
<catalog>
<name>USB Watch</name>
<description>So, you need to tell the time of course, but you also need a way
to carry your valuable data with you at all times (you know - your MP3 files,
favorite images, your ThinkGeek shopping list). This watch can handle the
mission for you and do it in style. It can store up to 256 MB of data.</
description>
<price>129.99</price>
<image>assets/products/usbwatch.jpg</image>
<thumbnail>assets/products/usbwatch_sm.jpg</thumbnail>
...
</catalog>
ShoppingCart
The ShoppingCart object is defined in an ActionScript class because it performs data storage and
data manipulation. An ActionScript class is the appropriate component type because it can
contain both properties and methods.
The ShoppingCart class contains the following properties:
• var items
• var total
The class contains the following methods:
• addItem()
• getItemCount()
• getTotal()
• removeItemAt()
The component is declared in the FlexStore.mxml file using a
<ShoppingCart> tag.
CartView
The CartView object is defined in an MXML component because it is a visual object that you can
create using MXML tags and a small amount of ActionScript code. The top-level tag of the
CartView component is a Panel container.
The CartView component uses a
<mx:Script> tag to include the ActionScript file
CartView_script.as. That file contains the following property definitions:
• var selectedItem
• var dataObject
The
dataObject property stores ShoppingCart data.










