frankybones
asked on
equal to and less than
Here is the scenario I have an input box (input1)
I have a button to test the input box with the following script on it:
on (release) {
if (eval(input1 >= 1.4 and input1<= 1.5)) {
this.right1.gotoAndPlay(2) ;
} else {
input1 = "";
this.wrong1.gotoAndPlay(2) ;
}
}
This is what I am trying to accomplish--that whatever the user inputs into the input box
has to be between 1.4 and 1.5 in order to get the question correct.
but of course my script does not work...can someone please tell me why?
I have a button to test the input box with the following script on it:
on (release) {
if (eval(input1 >= 1.4 and input1<= 1.5)) {
this.right1.gotoAndPlay(2)
} else {
input1 = "";
this.wrong1.gotoAndPlay(2)
}
}
This is what I am trying to accomplish--that whatever the user inputs into the input box
has to be between 1.4 and 1.5 in order to get the question correct.
but of course my script does not work...can someone please tell me why?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
create an input text, give it variable name in the Var box in its properties pannel, say"data1"
now create a button, in its action add the following:
on (release) {
if (data1 >= 1.4 && data1<= 1.5) {
trace("true");
} else {
data1 = "";
trace("false");
}
}
im assuming u r running flash MX, if u r running flash 5 and the above didn't work, try this:
on (release) {
if (eval(data1) >= 1.4 && eval(data1)<= 1.5) {
trace("true");
} else {
data1 = "";
trace("false");
}
}
hope this helps,
kanary.