6 Replies Latest reply on Jan 1, 2010 5:33 AM by Ned Murphy

    Masking Textfield Number ( Like Serial Inputs ) ?

    h.asaleh

      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

        • 1. Re: Masking Textfield Number ( Like Serial Inputs ) ?
          Ned Murphy Adobe Community Professional & MVP

          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.

          1 person found this helpful
          • 2. Re: Masking Textfield Number ( Like Serial Inputs ) ?
            h.asaleh Level 1
            function(){return A.apply(null,[this].concat($A(arguments)))}

            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

            • 3. Re: Masking Textfield Number ( Like Serial Inputs ) ?
              h.asaleh Level 1

              OMG O_O

              Did you include some code in your reply , when i copy your text into quote and post i can see this

               

              function(){return A.apply(null,[this].concat($A(arguments)))}

               

              is this some sort of bug in this board or some js functions that my browser didn't support

               

              let me quote all of your text

               

              function(){return A.apply(null,[this].concat($A(arguments)))}

              function(){return A.apply(null,[this].concat($A(arguments)))}

              Ned Murphy wrote:

               

              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.


              Edit : hmmm , so funny that part of code is somewhere out of you message even it will include top of your name :?

               

              Can you explain me this code , A is my var ?

              Where this function going to return ?

              a bit complicated

              • 4. Re: Masking Textfield Number ( Like Serial Inputs ) ?
                Ned Murphy Adobe Community Professional & MVP

                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).

                • 5. Re: Masking Textfield Number ( Like Serial Inputs ) ?
                  h.asaleh Level 1

                  i didn't mean to provide a solution for me , i just wonder is this possible and if it is , how can i do that i don't know this is part of string methods i think just like others it's some function or trick , anyway thanks and man why you say this i don't say give me solution i just ask to direct me to aa article or where i could start

                   

                  thanks , solved

                  • 6. Re: Masking Textfield Number ( Like Serial Inputs ) ?
                    Ned Murphy Adobe Community Professional & MVP

                    You're welcome.

                    1 person found this helpful