如何停止在spark文本区域中一次触发两个事件(as3+flex4)
textChanged 和 valueCommit 两个事件侦听器都附加了一个 Spark textarea,如下所示:
addEventListener("textChanged",
function(event:Event):void {
colorize();
},false,0,true);
addEventListener("valueCommit",
function(event:Event):void {
colorize();
},false,0,true);
如果我在 textarea 中键入任何内容,则此 colorize() 函数将被调用两次。我怎样才能阻止这两个事件不应该一起触发呢?请帮忙
textChanged and valueCommit both event listener are attached with a spark textarea as follows:
addEventListener("textChanged",
function(event:Event):void {
colorize();
},false,0,true);
addEventListener("valueCommit",
function(event:Event):void {
colorize();
},false,0,true);
if I type any thing in textarea, then this colorize() function is called twice. How can I stop this one that both event should not be triggered together. Pls help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你想监听打字,为什么要有两个监听器?如果您确实需要两个侦听器,则需要使用
setTimeout
对colorize
进行排队,而不是直接调用它:If you want to listen for typing, why do you have two listeners? If you really need two listeners, you need to queue
colorize
with asetTimeout
instead of calling it directly: