Having problems comparing with If statement (Basic)
Hi, at school we are learning to use Flash and we are using AS2, and I was working on an example code, but it doesn't seem to want to work. Here is the code:
var money:Number=0;
dollar_btn.onPress=function()
{
money+=1;
box_txt.text=money;
}
if(money>5){
check_btn.onPress=function()
{
box2_txt.text="Yay!";
}
}
As you can see, all I want to do is have a button, that once pressed, adds 1 to the money counter, and one it is higher than 5, I can press the next button and have it display "Yay!". The problem is, the if doesn't seem to work, even if the money variable is way above 5. I don't think it's a problem with the buttons, because I have tried changing the code to declare the variable with a starting value of 6, and the If works. Any ideas? It would be greatly appreciated
!
Thanks in advance ![]()
