);
[Bindable]
private var shoppingCartData:XMLListCollection;
private function dishesXMLHandler(event:ResultEvent):void
{
dishesDP = event.result..category;
}
private function addToShoppingCart():void
{
var itemToUpdate:XMLList = shoppingCartXML.product.(@id == dishesTree.selectedItem.@id);
if(itemToUpdate.qty > 0)
{
itemToUpdate.qty=Number(itemToUpdate.qty)+1;
}
else
{
var newItem:XML =
{dishesTree.selectedItem.@name}
{dishesTree.selectedItem.@price}
1
;
shoppingCartXML.appendChild(newItem);
}
shoppingCartData = new XMLListCollection(shoppingCartXML.children());
}
private function removeFromShoppingCart():void
{
}
private function clearCart():void
{
}
private function populateForm(event:Event):void
{
var node:XML=event.target.selectedItem;
if(node.@price != undefined)
{
prodName.text = node.@name;
listPrice.text = node.@price;
description.text = node.@description;
theImage.source = "actionscript-e4x-assets-"+node.@image;
theForm.visible = true;
}
else
{
theForm.visible = false;
prodName.text = "";
listPrice.text = "";
description.text = "";
theImage.source = "";
}
}
private function initApp():void
{
clearButton.enabled=false;
}
]]>