问题
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
回答1:
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", "");
}
来源:https://stackoverflow.com/questions/1239891/as3-textarea-component-disallow-user-to-enter-a-line-break