Flex : 按钮就像退格键一样 [英] Flex : button acting like a backspace

查看:32
本文介绍了Flex : 按钮就像退格键一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何让按钮事件调用一个函数,它的作用类似于退格键盘事件删除.

How would you make a button event call a function which acts like a backspace keyboard event delete.

我尝试使用键码 8 和键号 8 伪造调度键盘事件keyup"keydown",但没有成功.

I tried faking the dispatch keyboard event "keyup" "keydown" with keycode 8 and keynumber 8 without success.

除了使用开始和结束选择索引加上 substr 手动完成之外,没有其他方法吗?

No other way than doing it by hand with begin and end select index plus substr ?

我有一个文本输入,我只想添加一个像退格键一样的按钮.

I have a textinput i just want to add a button acting like a backspace.

谢谢

推荐答案

您可以使用 ASCII 码 8 并将其转换为字符或使用转义字符 '\b'

You can use the ASCII code 8 and translate it to a char or use the escape character '\b'

或者你可以操作 textFieldInstance 对象:

or you can manipulate the textFieldInstance object:

textFieldInstance.text = textFieldInstance.text.substr( 0, -1 );

见:

http://board.flashkit.com/board/showthread.php?t=246003

http://www.java2s.com/Code/Flash-Flex-ActionScript/String/InsertingSpecialWhitespaceCharactersBackspaceb.htm

http://www.wipeout44.com/brain_food/flash_actionscript_goodies.asp

http://www.ultrashock.com/forums/actionscript/deleting-chars-in-a-text-field-eg-backspace-124649.html

这篇关于Flex : 按钮就像退格键一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆