I noticed this post was done on the 1st but just in case you still need help ...
I did something similar to what you're doing and what I did was set up a variable to save the current focus then use the onSetFocus function on each of your text fields to set a new value for the variable e.g.
//Set initial variable value (initial focus)
var FocusedField = textField02_txt;
//When focus is on field set new variable value
textField01_txt.onSetFocus = function () {
FocusedField = textField01_txt;
};
Then on pressing the button to insert a character do something like this:
button_btn.onRelease = function () {
//Send the focus back to the last focused text field
Selection.setFocus(FocusedField);
//Show the caret at the end of the text
Selection.setSelection(FocusedField.length,FocusedField.length);
//Add character to end of text
FocusedField.text = FocusedField.text + "a";
//Show the caret at the end of the text
Selection.setSelection(FocusedField.length,FocusedField.length);
};
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.