MACROMEDIA FLEX BUILDER-USING FLEX BUILDER Use Manual page 72

Table of Contents

Advertisement

Open the CartView.mxml file located in the fbBindings folder.
1.
In Code view, enter the following code after the opening
2.
<mx:Script>
var dataObject:ShoppingCart;
</mx:Script>
The variable declaration creates a property of the CartView component. You want to use this
property in the
the component.
Locate the
3.
<mx:DataGrid>
<mx:DataGrid id="dg"
dataProvider="{dataObject.items}"
...
Locate the
4.
<mx:Label>
as follows (shown in bold type):
<mx:Label styleName="price"
text="Total: ${dataObject.total}" />
Save the CartView.mxml file.
5.
Switch to your flexstore.mxml file.
6.
In Code view, locate the
7.
bold type):
<local:CartView xmlns:local="*"
id="cartView"
dataObject="{cart}"
...
You bind the
CartView component.
Save the flexstore.mxml file.
8.
Press F12 to test the file in a browser.
9.
Click any product in the list view or the thumbnail view. The product details should appear in
the product detail area. Click the Add to Cart button to add the product to the shopping cart.
Choose another product, change the quantity, and click the Add to Cart button again.
72
Chapter 2: Flex Builder Tutorials
tag in the flexstore.mxml file to pass the shoppingCart object to
<CartView>
tag, and add the following property (shown in bold type):
tag near the end of the file and modify the value of the
<local:CartView>
property to the shopping cart object (cart) to pass the object to the
dataObject
<mx:Panel>
tag, and add the following property (shown in
tag:
property
text

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex builder

Table of Contents