For 1 you would probably have to add an event listener for keydown,
see what key it was and then stop that keycode from reaching the textarea.

For 2, check out the following I found in the Help:

<?xml version="1.0"?>
<!-- textcontrols/TextRangeExample.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>
  <mx:Script><![CDATA[
     import mx.controls.textClasses.TextRange

     private function resetText():void
     {
        textArea1.text = "This is a test of the emergency broadcast
system. It is only a test.";
     }

     public function alterText():void
     {
        // Create a TextRange object starting with "the" and ending at
the 
        // first period. Replace it with new formatted HTML text.
        var textRange1:TextRange = new TextRange(
            textArea1, false, textArea1.text.indexOf("the", 0),
textArea1.text.indexOf(".", 0)
        );
        textRange1.htmlText="<i>italic HTML text</i>"

        // Create a TextRange object with the remaining text.
        // Select the text and change its formatting.
        var textRange2:TextRange = new TextRange(
            textArea1, true, textArea1.text.indexOf("It", 0),
textArea1.text.length-1
        );
        textRange2.color=0xFF00FF;
        textRange2.fontSize=18;
        textRange2.fontStyle = "italic"; // any other value turns
italic off
        textRange2.fontWeight = "bold"; // any other value turns bold off
        textArea1.setSelection(0, 0);
     }
  ]]></mx:Script>

  <mx:TextArea id="textArea1" fontSize="12" fontWeight="bold"
width="100%" height="100">
     <mx:text>
        This is a test of the emergency broadcast system. It is only a
test.
     </mx:text>
  </mx:TextArea>
  <mx:HBox>
    <mx:Button label="Alter Text" click="alterText();"/>
    <mx:Button label="Reset" click="resetText();"/>
  </mx:HBox>
</mx:Application>


--- In flexcoders@yahoogroups.com, "khan.ibraheem" <[EMAIL PROTECTED]>
wrote:
>
> Hello,
> 
> I am using a textarea. I want to achieve 2 tasks:
> 
> 1) Disable a particular character i.e. let suppose I dont want to
> allow a certain character being shown(when it is typed) in the text
area.
> 
> 2) How can I remove some portion of the text from the textarea. I have
> tried slice method but it hasnt worked.
> 
> Looking for help.
> 
> Thanks.
>


Reply via email to