Textfield == a number problem

Arghhh, I’m going crazy over here. In AS2 it’s NOOO problem, but in AS3 it just throws errors.

What I want to do is to check if a variable is == to something they type in a textfield.

I have a textfield with the name of “pat”. The user can click it and enter a number. I want it so that if they enter 1234, the code triggers.

var lat:Number = 1234
addEventListener(Event.ENTER_FRAME,whatever);
function whatever(event:Event):void {
if (pat==lat) {
trace(“ok”)
Back.visible=true;
} else {
Back.visible=false;
}
}

In AS2 it didn’t care what type of stuff was entered in the textfield, it gladly compared it to any variable, but now it just complains about how it can’t compare a value with a static type blaaah:

Scene 1, Layer ‘Layer 1’, Frame 1, Line 27 1176: Comparison between a value with static type flash.text:TextField and a possibly unrelated type Number.

And I can understand that, but how do I make it work?