Alright. I’ve made a tool in flash that calculates the value of money in comparison to the value of goods avaliable. however, the values that my program is supposed to calculate wont update when variables are changed, how do i fix this?
here is my code, commented for ease of reading:
/* Declares amtGood */
var amtGood:Number = 10;
/* Adds 1 to amtGood */
produce1.onRelease = function() {
amtGood += 1;
trace(amtGood);
};
/* adds 10 to amtGood */
produce10.onRelease = function() {
amtGood += 10;
trace(amtGood);
};
/* adds 50 to amtGood */
produce50.onRelease = function() {
amtGood += 50;
trace(amtGood);
};
/* Declares amtMon */
var amtMon:Number = 10;
/* Adds 1 to amtMon */
print1.onRelease = function() {
amtMon += 1;
trace(amtMon);
};
/* Adds 10 to amtMon */
print10.onRelease = function() {
amtMon += 10;
trace(amtMon);
};
/* Adds 50 to amtMon */
print50.onRelease = function() {
amtMon += 50;
trace(amtMon);
};
/* Declares valGood */
var valGood:Number = amtMon / amtGood;
As a brief explanation, I have 4 sets of buttons (the code for the first two sets is in there), They Create goods that are used to back paper currency (amtGood and amtMon are the amount of goods and money). To calculate the dollar value of goods, the total money is devided by the total amount of goods. However it won’t calculate anything but the original 10/10