I am having problem calculating values to be stored in variables in my flash shopping basket project. I have 3 items that can be bought and 3 output fields each showing the number of the specific item in the shopping basket, the price per item and lastly the accumulative cost of that item. this all works fine.

I have now added a bin button that is placed next to each output field that on press, will delete that output field. The button press will also reduce the total order by
(amount of item x previously in the basket*price per item x)
I also have a stock figure for each item that was retrieved from a database on load. If a shopper wants to buy then this stock figure needs to be returned to update the database (or a minus figure needs to be sent back) - not a problem in this particular button press as the stock figure is adjusted on the flash front end.

Any way, hope you are following, here is my code for the "bin" button press.

on (release) {
_root.output = "";
_root.tobuy = "";
_root.total = _root.total-_root.mcdrag.accum;
_root.stock2 = _root.stock2+_root.mcdrag.itemqty;
_root.bin1._visible = false;
_root.mcdrag.itemqty = _root.mcdrag.itemqty-_root.mcdrag.itemqty;
}


Everything seems to work fine -i can drag item x to the shopping basket and calculations are performed to give a running total of it's contents . The bin button also works and when pressed will reduce the total basket value by the value of the particular good (good "x"). All stock figures are too updated.

The problem is that if i have 6 or more units of item x in my basket, when i press the bin button, the total figure doesnot display "0" it displays "3.55127.."
Everything works fine until you decide to bin 6 or more of any item.


I cannot understand this can anyone help?