title: How can I disable carriage returns within an editable TextArea?
body: <p>I am simply wanting to stop a user entering carriage returns in a TextArea. I have been experimenting with the 'restrict' property in the TextArea but cant seem to work it out.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>&lt;mx:Canvas id="cvs1" label="Panel 1" width="100%" height="100%" creationComplete"addEvtListnerOnPlaceText()" backgroundColor="#FFFFFF"&gt;
      &lt;mx:TextArea id="txtP1T1" x="10" y="176" text="{placeName}" width="210" textAlign="center" color="#DC0000" restrict="this is where I need some help"/&gt;
  &lt;/mx:Canvas&gt;
  </code></pre>
  
  <p>I'm not sure if the restrict property will cover this or not but any help will be much appreciated.</p>
  
  <p>I've now managed to get something working:</p>
  
  <pre><code>    private function addEvtListnerOnPlaceText():void{
          txtP1T1.addEventListener(KeyboardEvent.KEY_DOWN, onKeyEventDown);
          txtP1T1.addEventListener(KeyboardEvent.KEY_UP, onKeyEventUp);
      }
  
      [Bindable]
      public var tempString:String;
      private function onKeyEventDown(e:KeyboardEvent):void
      {
          var character:String = String.fromCharCode(e.charCode);
  
          if (e.keyCode == 13)
          {
              tempString = txtP1T1.text;
              KeyboardEvent.KEY_UP;
          }
  
      }
      private function onKeyEventUp(e:KeyboardEvent):void
      {
          var character:String = String.fromCharCode(e.charCode);
  
          if (e.keyCode == 13)
          {
              txtP1T1.text = tempString;
          }
  
      }
  </code></pre>
  
  <p>The only issue now is that if you hold return down, it clears the first carriage return and then keeps adding as long as you hold it down. I need a way to stop this happening without just losing focus on the text area.</p>