topical media & game development
lib-flex-store-productsView-ProductCart.mx
lib-flex-store-productsView-ProductCart.mx
(swf
)
[ flash
]
flex
<?xml version="1.0" encoding="utf-8"?>
<!--
//////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2003-2006 Adobe Macromedia Software LLC and its licensors.
// All Rights Reserved.
// The following is Sample Code and is subject to all restrictions on such code
// as contained in the End User License Agreement accompanying this product.
// If you have received this file from a source other than Adobe,
// then your use, modification, or distribution of it requires
// the prior written permission of Adobe.
//
//////////////////////////////////////////////////////////////////////////
-->
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:productsView="*"
horizontalAlign="right"
paddingTop="8"
paddingBottom="8"
paddingRight="4"
paddingLeft="4"
horizontalScrollPolicy="off"
verticalScrollPolicy="off">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
//import samples.flexstore.Product;
//import samples.flexstore.ProductListEvent;
[Bindable]
public var numProducts:int=0;
[Bindable]
private var total:Number = 0;
private const SHIPPING:Number = 1.99;
private function productListEventHandler(event:lib_flex_store_samples_flexstore_ProductListEvent):void
{
switch (event.type)
{
case lib_flex_store_samples_flexstore_ProductListEvent.ADD_PRODUCT:
event.product.qty = 0;
//fall through into the same logic as dup
case lib_flex_store_samples_flexstore_ProductListEvent.DUPLICATE_PRODUCT:
event.product.qty++;
total += event.product.price;
numProducts++;
break;
case lib_flex_store_samples_flexstore_ProductListEvent.PRODUCT_QTY_CHANGE:
case lib_flex_store_samples_flexstore_ProductListEvent.REMOVE_PRODUCT:
var items:Array = productList.items;
total = 0;
numProducts = 0;
for (var i:int=0; i < items.length; i++)
{
var product:lib_flex_store_samples_flexstore_Product = items[i].product;
total += product.qty * product.price;
numProducts += product.qty;
}
break;
default:
break;
}
}
]]>
</mx:Script>
<mx:CurrencyFormatter currencySymbol="
(C) Æliens
18/6/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.