My create/destroy button does not affect whether or not my buttons increment / decrement variables. Can anyone give me some help with this?
Here is a picture of my interface, and some code
[url=“http://xs29.xs.to/pics/05206/Money.png”]http://xs29.xs.to/pics/05206/Money.png
/* Declares aGood */
var aGood:Number = 10;
/* Declares aMon */
var aMon:Number = 10
// declaration of credes, set to 1 by default
var credes:Number = 1
// when the create button is released, credes = 1
create.onRelease = function() {credes = 1};
// when the destroy button is released, credes = 0
destroy.onRelease = function() {credes = 0};
// Output and calculations
// positive goods
if (credes = 1) {
g1.onRelease = function() {
aGood += 1;
// calculates cost of goods
pvGood = aMon / aGood
vGood = int((pvGood)*10000)/10000;
// calculates the value of money
pvMon = aGood / aMon
vMon = int((pvMon)*10000)/10000;
};
}
if (credes = 1) {
g10.onRelease = function() {
aGood += 10;
// calculates cost of goods
pvGood = aMon / aGood
vGood = int((pvGood)*10000)/10000;
// calculates the value of money
pvMon = aGood / aMon
vMon = int((pvMon)*10000)/10000;
};
}
if (credes = 1) {
g50.onRelease = function() {
aGood += 50;
// calculates cost of goods
pvGood = aMon / aGood
vGood = int((pvGood)*10000)/10000;
// calculates the value of money
pvMon = aGood / aMon
vMon = int((pvMon)*10000)/10000;
};
}
// positive money
if (credes = 1) {
m1.onRelease = function() {
aMon += 1;
// calculates cost of goods
pvGood = aMon / aGood
vGood = int((pvGood)*10000)/10000;
// calculates the value of money
pvMon = aGood / aMon
vMon = int((pvMon)*10000)/10000;
};
}
if (credes = 1) {
m10.onRelease = function() {
aMon += 10;
// calculates cost of goods
pvGood = aMon / aGood
vGood = int((pvGood)*10000)/10000;
// calculates the value of money
pvMon = aGood / aMon
vMon = int((pvMon)*10000)/10000;
};
}
if (credes = 1) {
m50.onRelease = function() {
aMon += 50;
// calculates cost of goods
pvGood = aMon / aGood
vGood = int((pvGood)*10000)/10000;
// calculates the value of money
pvMon = aGood / aMon
vMon = int((pvMon)*10000)/10000;
};
}
// negative goods
if (credes = 0) {
g1.onRelease = function() {
aGood -= 1;
// calculates cost of goods
pvGood = aMon / aGood
vGood = int((pvGood)*10000)/10000;
// calculates the value of money
pvMon = aGood / aMon
vMon = int((pvMon)*10000)/10000;
};
}
if (credes = 0) {
g10.onRelease = function() {
aGood -= 10;
// calculates cost of goods
pvGood = aMon / aGood
vGood = int((pvGood)*10000)/10000;
// calculates the value of money
pvMon = aGood / aMon
vMon = int((pvMon)*10000)/10000;
};
}
if (credes = 0) {
g50.onRelease = function() {
aGood -= 50;
// calculates cost of goods
pvGood = aMon / aGood
vGood = int((pvGood)*10000)/10000;
// calculates the value of money
pvMon = aGood / aMon
vMon = int((pvMon)*10000)/10000;
};
}