I have an input box which I enter a numerical value into, I want to compare this value with a variable (_total), but beause its a string it won’t compare it to a number value, I’ve tried varius things including parseInt() but I can’t seem to get it to work. Any ideas? Code so far below:
Thanks
var _total:Number = new Number()
var myAnswer:TextField = new TextField();
myAnswer.type = TextFieldType.INPUT;
myAnswer.maxChars = 2;
myAnswer.restrict = “0-9”;
function onClick(event:MouseEvent):void {
myAnswer.text = Number(myAnswer1);
if (MyAnswer == (_total)) {
trace("Correct!");
} else {
trace("Wrong!");
}
}