Skip to main content
Participating Frequently
December 31, 2009
Answered

Masking Textfield Number ( Like Serial Inputs ) ?

  • December 31, 2009
  • 1 reply
  • 604 views

Hi there

I have a number like this 22536325214589 and i want to separate it by 4 digits and show in separated input textfields like serial nubmer input on applications and if user try to change it skip to next field while typing And also i can return number again into one variable

thanks in advance

This topic has been closed for replies.
Correct answer Ned Murphy

Whatever that code is I didn't do it.  These forums have issues, and that bit of code you saw is one of them.

The simpler means for achieving your goal is to treat the number as a string and break it into pieces.  If you don't know how to use the Flash help documents, then you probably need to learn that first.  Search the Flash help documents for the String class, and then look at the various methods it includes.  You should be able to find a few possible ways to break your number string into substrings and then write them into the textfields.

It is better if you come here with something to show that you are having trouble getting working than to just say you want to do something and don't know how.  People are more apt to help you along with actual problem situations than they are to provide a solution for you (many of us earn our living doing design work for others).

1 reply

Ned Murphy
Legend
December 31, 2009

Look into the variety of String methods that are available.  If the number does not start off as a string, convert it to one and then use one of the methods to divide out the segments.  For manual entry, you will need to use the onChanged method of the TextField in order to test the length of the current entry, and if it equals 4, move the focus to the next textfield in the sequence.  Then, to reform the value, simply add the contents of each textfield into a single string.

h_asalehAuthor
Participating Frequently
December 31, 2009

Look into the variety of String methods that are available

If the number does not start off as a string, convert it to one and then use one of the methods to divide out the segments

Thanks for reply

Can you direct me to some sample or page that show how to do that , and it's not important i can use Number instead of string if it's hard , and if i want to push a number into seprated fileds then user can change it ( i mean for manual it's ok with your help and if i want to read number from a string or number var and enter it into those fields ? , i can do it easily in .Net but i with mask functions but in flash i need help