Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.23 / 5.00 3,881 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.93 / 5.00 4,634 ViewsI'm trying to develop a math app. When a user is pretended with a question such as 1+1 the user is required to type in the answer. If the user puts 2 they will go to the next frame, else the user stays on the same frame.
How do I go about doing this? I have tried
if ("textbox" = 2)
{
gotoAndStop(2)
}
;
"textbox" being the input text field and the value of what the user should type "2".
if ("textbox" = 2)
There are so many things wrong with this one line. Taking the time to learn the basics of the language is really important.
First of all, you're using "=". The equal operator is used to assign a value to a variable. What you want is to check the equality of something, so you do "==".
myVar = 2 //gives myVar a value of 2
myVar == 2 //checks if myVar is equal to 2, and returns true or false
Second, what you're doing here is checking a string against a number.
Third, the way you access the text inside a text box is by
textBox.text At 1/17/13 10:27 AM, 4urentertainment wrote:if ("textbox" = 2)There are so many things wrong with this one line. Taking the time to learn the basics of the language is really important.
First of all, you're using "=". The equal operator is used to assign a value to a variable. What you want is to check the equality of something, so you do "==".
myVar = 2 //gives myVar a value of 2
myVar == 2 //checks if myVar is equal to 2, and returns true or false
Second, what you're doing here is checking a string against a number.
Third, the way you access the text inside a text box is by
textBox.text
I've tried attaching it to the instance in a MC and on a frame but it still doesn't work.
{
//var answer;
if (answer.text == 1)
{
gotoAndStop(2);
}
}
Your big problem is using AS2, and using it on MovieClips no less. If it was AS3 you could just post all your code, but with AS2 someone would have to look though your fla and make sure your names, frame, and events around the code are set correctly. Do yourself a favour, if you ever plan on becoming a programmer switch to AS3.