| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| DesignersTalk > If statement comparing a variable and input... |
|
LinkBack | Thread Tools | Search this Thread |
|
|
#1 (permalink) |
|
Registered User
Join Date: Nov 2007
Location: UK
Posts: 8
|
If statement comparing a variable and input...
Hi I'm quite new to all this flash m'larky so forgive me if this seems a bit stupid... I'm trying to make a basic game where two random numbers are generated and added together, then the user needs to put the answer into an input box in digits and check it. I'm just using "trace" to say whether the answer is right or wrong for the minute. Im having problems with the check_btn part of the code. I'm trying to simply check if the user has put in the same number as the correct answer but every time it always traces "incorrect" whether it is or not. I tried declaring userAnswer_txt as a variable and using that in the if statement but had the same problem... Any ideas??? Code:
Thanks |
|
|
|
|
|
#6 (permalink) |
|
Registered User
Join Date: Dec 2007
Posts: 11
|
Hey gilbs your problem comes from the way flash handles data from textfields. Your code is solid enough so it should work if you change it abit like this: Code:
|
|
![]() |