@miltoon71: Thank you for your hint!

I was trying to delete the text inside a
TextArea-component after hitting
Keyboard.ENTER.

Here is the solution:

    var ta_report:TextArea = new TextArea();
    var tr_report:TextRange = new TextRange(ta_report, true, 0,
ta_report.length);
    tr_report.text = '';

... ugly bug,
masu


On Mon, Jun 9, 2008 at 5:50 PM, miltoon71 <[EMAIL PROTECTED]> wrote:

>   --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>,
> "miltoon71" <[EMAIL PROTECTED]> wrote:
> >
> > Hi
> > Trying to insert some characters on every new row when the user hits
> enter...
> > The following does not work:
> >
> > // Define a textarea:
> > <mx:TextArea id="myTextArea">
> >
> > // Add a keystroke listener
> > myTextArea.addEventListener(KeyboardEvent.KEY_DOWN,keyHandler);
> >
> > // Handle keystrokes
> > private function keyHandler(event:KeyboardEvent):void{
> > if(event.keyCode == Keyboard.ENTER){
> > this.myTextArea.text += "added text";
> > }
> > }
> >
> >
> > However, if you add a random alert message in the middle, it suddenly
> works:
> >
> > private function keyHandler(event:KeyboardEvent):void{
> > Alert.show("Dummy message");
> > if(event.keyCode == Keyboard.ENTER){
> > this.myTextArea.text += "added text";
> > }
> > }
> >
> >
> > Isn't this strange?
> >
>
> Issue fixed by using TextRange class instead...
>
>  
>

Reply via email to