views:

719

answers:

1

Hy I'm trying to prevent the user to enter any form of line breaks in a as3 textarea component.

I tried using the restrict param of the textarea like this:

foo.restrict = "^/\r\n//\n/"

but i don't have any success.

Hope anybody can help me out on the correct way to do this.

thanks in advance Milan

+2  A: 

I don't think you can do that. The workaround is replacing cartridge return with empty string in the CHANGE event.

import flash.events.*;

foo.addEventListener(Event.CHANGE, test_change);

function test_change(e:Event)
{
    foo.text = foo.text.replace("\r", "");
}
David
Thank's David looks like that's true since everybody else i asked came also up with this answer.cheersmilan
lordarmitage