0
votes

I am looking to know how we can have multiple buttons with a single dynamic text field that by clicking on the buttons we add one digit to the last digit available in the text field and unloading the last digit that has been added by clicking an other button with the help of as2.

1

1 Answers

0
votes

Once you've created the buttons (which are assumed to be movieclips for now), you could do it by adding an id value to each button, then setting an onPress listener

Within the listener, you'd check the id of that button and add/append the appropriate number char to a string, which is displayed/updated in your textfield.

For the button that removes the last number, you can create an onPress listener that does a substring() call on the string which would go from 0 to the length of the string minus 1 to chop the last character off. Then display/update that string in your textfield once again.