Shopping cart List?

Shopping cart List

Hi all,

I’m trying to produce a shopping cart, so I have a list of products and prices that come from XML. When I click one of the products I want to add that to a list below and then show a sub total. The problem is when I click a product the list below is just replaced by the last product, so it’s not a list, but just replaced all the time by what I’m pressing.

[AS]
_global.Total = 0;
changeColor = function (tar, col) {
banColor = new Color(tar);
banColor.setRGB(col);
};
cart_xml = new XML();
cart_xml.ignoreWhite = true;
cart_xml.onLoad = function(success) {
if (success) {
shoppingCart();
} else {
trace(“cart xml not loaded”);
}
};
cart_xml.load(“cart.xml”);
shoppingCart = function () {
proNames = cart_xml.firstChild.childNodes;
for (var i = 0; i<proNames.length; i++) {
fontInfo = proNames*;
buy = fontHolder_mc.attachMovie(“btn_mc”, “btn_mc”+i, i+1);
buy._y = 18*i;
buy.idcolor = fontInfo.attributes.color;
buy.name = fontInfo.attributes.name;
buy.price = fontInfo.attributes.price;
buy.name_txt.text = buy.name;
changeColor(buy.base_mc, buy.idcolor);
if (buy.name != “ONE” && buy.name != “TWO”) {
buy.price_txt.text = “£”+buy.price;
buy.base_mc._alpha = 50;
buy.onRollOver = function() {
this.base_mc._alpha = 100;
};
buy.onRollOut = function() {
this.base_mc._alpha = 50;
};
buy.onRelease = function() {
cartBtn = cart_mc.attachMovie(“cartbtn_mc”, “cartbtn_mc”+i, i+1);
cartBtn.name_txt.text = this.name;
_global.Total += this.price;
total_txt.text = _global.Total;
};
}
}
};
[/AS]