# 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?
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
hello frankybones,

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.
Commented:
I think we need to convert to a Number(input1)...

on (release) {
if ((Number(input1)>=1.4) and (Number(input1)<=1.5)) {
this.right1.gotoAndPlay(2);
} else {
input1 = "";
this.wrong1.gotoAndPlay(2);
}
}

hope that helps,

rexmor

Experts Exchange Solution brought to you by