Action for variable within a number range

Need to send a user to different frames depending on a number input into a text field. Here is what I have, but regardless of number, it send them to Frame 20. New to AS and having a tough time figuring this out. Any help would be very appreciated.

var HDLrange:int = int(enterRange_txt.text);

enterRange_btn.addEventListener(MouseEvent.CLICK, onClick);

function onClick(event:MouseEvent):void
{

if (HDLrange > 0 && HDLrange < 40)
{

    gotoAndStop(10);
}

else
{gotoAndStop(20);
}

}

stop();