AS3 textarea的组件:禁止用户输入一个换行符 [英] as3 textarea component: disallow user to enter a line break
本文介绍了AS3 textarea的组件:禁止用户输入一个换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
海兰我试图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", "");
}
这篇关于AS3 textarea的组件:禁止用户输入一个换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文