buttons enabled/not enabled problem
I have a problem making a flash rpg game. I was reading many tutorials but I cant seem to do it correctly. I will appreciate any help!
This should work as follows: I have 100 hours to do some things like work, study etc. and each of these actions will reqire 1 hour to complete. After there will be 0 hours left, the buttons required for performing "work", "study" etc should be disabled.
Problem: When I reach 0 hours, it then start to count hours left upwards! 1,2,3...
This is the code:
// Variables
var money:Number = 0;
var hours:Number = 16;
//Button name :"work" (other buttons will have similar code)
on (release) {
money += 100,,
hours -= 1;
}
//Buttons enabled/disabled
if (hours < 1) {
work._alpha = 50;
work.enabled = false;
} else {
work._alpha = 100;
work.enabled = true;
}
Once again thanks for any help or suggestions!