Flex:按钮的作用类似于退格键 [英] Flex : button acting like a backspace
问题描述
如何使按钮事件调用一个类似于退格键键盘事件删除的功能.
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 ?
我有一个textinput,我只想添加一个像退格键一样的按钮.
I have a textinput i just want to add a button acting like a backspace.
谢谢
推荐答案
您可以使用ASCII代码8并将其转换为char或使用转义字符'\ 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.wipeout44.com/brain_food/flash_actionscript_goodies.asp
这篇关于Flex:按钮的作用类似于退格键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!