title: flash as3 adding focus listener to an input text field
body: <p>Hi I'm trying to use the following code to add a listener to a text field which clears the field, but I'm getting the error:</p>
  
  <p>"Parameter Listener Must be Non-Null"</p>
  
  <p>This is the code I'm using:</p>
  
  <pre><code>//pos is the instance name of the textfield
      var posText = currCard.cardBack.pos;
      posText.addEventListener(MouseEvent.CLICK, clearText);
      posText.type = TextFieldType.INPUT;
  
  
      currCard.hit.visible = false;
  
      function clearText(e:MouseEvent) {
          trace ("clear");
          //posHolder = posText.text;
          //posText.text = "";
      }
  </code></pre>
  
  <p>I should add that this text fields starts out on stage as a dynamic text field. In the code above I am changing its type to input, so that might affect things.</p>
  
  <p>I am trying to set up the field so that when a user clicks in the text field, a cursor movie clip appears, and the text that was in the field is erased, and that when they leave the text field and click elsewhere, the text is accepted, the textfield converts back to a dynamic field, essentially "locking" the entered text into the field.</p>