Skip to main content
September 19, 2008
Question

To delete a character in text field

I have a text field name text.text. I create a button which on press a character appear in text.text. How is the action script on a button to delete a character in text.text ?

Ce sujet a été fermé aux réponses.

2 commentaires

September 23, 2008
I will like to make it simple. I create a text named Word. I have a few buttons namely a,b,c,d. When press a button, a appear in Word.
When press b button, b appear in Word and so on.If I press all the buttons, for example abcd, Word would have abcd. But if I press wrong
button, I press abcc instead of abcd, I have to delete c then press d
button in order to have abcd.
My question : How to add action script to a button so that I can delete
with button ?
September 19, 2008
same way you inserted text, if I am understanding your question.

Click button > text.text = "example"; // a string
Delete button > text.text = ""; //an empty string

Just have the delete button be an empty string. Is this what you want or are looking for ways of appending or removing characters from a string. If this is the case, maybe look at appendText to add characters and substring commands to remove characters. ActionScript 3.0 Cookbook was useful in illustrating these techniques.
September 22, 2008
I am sorry that I made a mistake.
I would like to delete an alphabet.
For example,if I type examplg, correct word is example, I would have to delete g then type e. Your answer is to delete the whole word, it is also helpful. Thanks.
Another question if you don't mind. Could I just hit Tab Key and start typing without pressing the mouse ?

Thanks