海兰我试图prevent用户在AS3 textarea的成分进入任何形式的换行符。
Hy I'm trying to prevent the user to enter any form of line breaks in a as3 textarea component.
我试图用这样的textarea的限制参数:
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.
在此先感谢 米兰
我不认为你可以做到这一点。解决方法是在更改事件空字符串替换墨盒的回报。
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", "");
}