The code might look a little hard to understand.
What I'm doing is checking the instance variables given to the text object with text.text (which is the text displayed in the textobject)
To set the text I use AnimationFrame because these frames are the same as the numbers displayed, but you could change that to an instance variable if that suits your need better.
The back button was there from an older version and isn't really needed. It removes 1 character from the length of the text and is instructed to do so from the left.
use the limit variable to set the length of the code desired
use the code variable to change the code.
the charactercount variable is used to see how many numbers have been pushed, this could be used for display-purposes.