Display message

Hi, I’m at a lost here. What I am trying to do is display a message of some sort if the user inputs an incorrect password into the form. I having difficuity with the fact that I only want to give them 2 tries. After the 2 attemps by the user display the message. “Please Contant the person who mangaes your server”.? I’m at a total lost here…

Here is what I have so far…


import mx.controls.*;
// strict type instances on the Stage.
//var username_ti:TextInput;
//var password_ti:TextInput;
//import mx.controls.Alert;

class Product {
    var status_lbl:Label;
    var id:Number;
    var ans:Number;
 
    function Product (id:Number) {
        _global._this = this;
        //id = getID();
    }
    
   public function getId () :Number{
        var userid=_root.id;
        _global.ans=123;
        //trace("your input is:"+ userid.toString());
        mx.accessibility.AlertAccImpl.enableAccessibility();
        _global.styles.Alert.setStyle("color", 0x4B8DEF);
        _global.styles.Alert.setStyle("themeColor", "haloBlue");
            
        var myGo = new Object;
        Key.addListener(myGo)
        myGo.onKeyUp = function(){
        if (userid==_global.ans) {
  Alert.show("Yes, You are Correct!");
  
  _root.userid.text = "Neurochrome";
  _root.userid.textColor = 0x696AC9;
  _root.userid.backgroundColor = 0xFFCC33;
  
  
  Selection.setFocus("_root.Name_txt");
  _root.Name_txt.textColor = 0x696AC9;
  _root.Name_txt.backgroundColor = 0xFFCC33;
  }else{
  _global.styles.Alert.setStyle("color", 0xE95252);
  _global.styles.Alert.setStyle("themeColor", "haloOrange");
  Alert.show("Incorrect!");
  
  
[COLOR=red]  //Checks to see if incorrect 2 times to display error message!
  if (userid.text. == incorrect>2) {
  status_lbl.text = "<font color=\"#9A319B\">Please contact the person who manages your  server.</font>";
  Selection.setFocus("_root.userid");[/COLOR][COLOR=yellow]
[/COLOR] }
  
  }
 }
        return userid;
    }
  
   }

Thank you all