No problem CyanBlue,
I've got the code adding to the Str Lvl now and not adjusting the cost, the problem is when the user removes the Strong trait from the datagrid how will I get Flash to minus it off the Str Lvl without adjusting the cost?
On the main timeline I have:
CODE
_global.gFinalCost = 0;
_global.gStrCost = 0;
_global.gStrongStr = 0;
myStrTxt.restrict = "0-7";
traits = new Array();
traits = [{TRAITS:"",LVL:"",$:""}];
traitsGrid.dataProvider = item;
traitsGrid.setSize(200,70);
traitsGrid.editable = false;
traitsGrid.dataProvider.removeItemAt(0);
remove_btn.onRelease = function ()
{
if(traitsGrid.selectedIndex <> undefined) {
//trace(weapGrid.dataProvider[weapGrid.selectedIndex]["Cost"]);
_global.gFinalCost -= Number(traitsGrid.dataProvider[traitsGrid.selectedIndex]["$"]);
traitsGrid.dataProvider.removeItemAt(traitsGrid.selectedIndex);
_global.gStrong = _global.gStrong - _global.gStrong;
}
}
var gSCArray = new Array("0","1","5","10","15","20","30","50");
onEnterFrame = function(){
_global.gStrCost = gSCArray[Number((myStrTxt.text) - Number(_global.gStrongStr))]
myStrCostTxt.text = gStrCost
finalCost.text = Number(gStrCost) + Number(gFinalCost);
}
And in the traits_mc I have :
CODE
strong_btn.onRelease = function () {
strongStr = (Number(_root.myStrTxt.text)) + (Number(myStrongTxt.text))
_root.myStrTxt.text = strongStr;
_global.gStrongStr = Number(myStrongTxt.text)
_root.traitsGrid.addItem({TRAIT:"Strong",LVL:Number(myStrongTxt.text),$:_root.gSCArray[Number(myStrongTxt.text)]});
_global.gFinalCost += Number(_root.gSCArray[Number(myStrongTxt.text)]);
gotoAndStop(1);
}
This post has been edited by pancreasboy: 4 Dec, 2008 - 08:10 PM