5 Replies Latest reply on Nov 3, 2006 1:27 AM by Newsgroup_User

    restricting a text field

    Level 7
      I asked a while ago and didn't get an answerthat answered the question, and
      now it has become rather more urgent.

      How do i restrict a text entry field so that users can only type into the
      available space, i.e NO scrolling horizontally or vertically.

      I can't find a way to do this.

      Many thanks

      Dave


        • 1. Re: restricting a text field
          TimSymons Level 1
          There are a couple of ways depending on how your textfield is created. If you create it dynamically then you can use the maxChar property of the textfield to set the maximum number of characters a user can enter into it. For example:

          this.createTextField("age_txt", this.getNextHighestDepth(), 10, 10, 30, 22);
          age_txt.type = "input";
          age_txt.border = true;
          age_txt.maxChars = 2;
          age_txt.restrict = "0-9";

          This code was taken from the Help files and limits the user to being able to enter only 2 characters maximum and that those characters must be numbers between 0 and 9. To just limit the number of characters, don't set the "restrict" property.

          If you are drawing the textfield on the screen in authoring mode in Flash then in the Properties box there is a place labeled "Maximum Characters:". Just enter in the maximum number of characters there.

          Tim
          • 2. Re: restricting a text field
            Level 7
            Thanks for that Tim.

            I've found the "restrict to a number of chars", and whilst that may work, I
            really wanted to restrict the overall size of the text they can type in, i.e
            no scrolling.

            For example, lots of "i" take up the same space as very few "w" so
            restricting the character count won't necessarily work.

            Any other solutions?

            "TimSymons" <webforumsuser@macromedia.com> wrote in message
            news:eicvsu$ph9$1@forums.macromedia.com...
            > There are a couple of ways depending on how your textfield is created. If
            > you
            > create it dynamically then you can use the maxChar property of the
            > textfield to
            > set the maximum number of characters a user can enter into it. For
            > example:
            >
            > this.createTextField("age_txt", this.getNextHighestDepth(), 10, 10, 30,
            > 22);
            > age_txt.type = "input";
            > age_txt.border = true;
            > age_txt.maxChars = 2;
            > age_txt.restrict = "0-9";
            >
            > This code was taken from the Help files and limits the user to being able
            > to
            > enter only 2 characters maximum and that those characters must be numbers
            > between 0 and 9. To just limit the number of characters, don't set the
            > "restrict" property.
            >
            > If you are drawing the textfield on the screen in authoring mode in Flash
            > then
            > in the Properties box there is a place labeled "Maximum Characters:". Just
            > enter in the maximum number of characters there.
            >
            > Tim
            >


            • 3. Re: restricting a text field
              Level 7
              Is there any answer to this?

              If it is a definite no it isn't possible could someone please confirm as I'm
              spending too much precious time trying to find out!

              Thanks

              "dave" <dave@nospam.co.uk> wrote in message
              news:eid27o$s8r$1@forums.macromedia.com...
              > Thanks for that Tim.
              >
              > I've found the "restrict to a number of chars", and whilst that may work,
              > I really wanted to restrict the overall size of the text they can type in,
              > i.e no scrolling.
              >
              > For example, lots of "i" take up the same space as very few "w" so
              > restricting the character count won't necessarily work.
              >
              > Any other solutions?
              >
              > "TimSymons" <webforumsuser@macromedia.com> wrote in message
              > news:eicvsu$ph9$1@forums.macromedia.com...
              >> There are a couple of ways depending on how your textfield is created. If
              >> you
              >> create it dynamically then you can use the maxChar property of the
              >> textfield to
              >> set the maximum number of characters a user can enter into it. For
              >> example:
              >>
              >> this.createTextField("age_txt", this.getNextHighestDepth(), 10, 10, 30,
              >> 22);
              >> age_txt.type = "input";
              >> age_txt.border = true;
              >> age_txt.maxChars = 2;
              >> age_txt.restrict = "0-9";
              >>
              >> This code was taken from the Help files and limits the user to being able
              >> to
              >> enter only 2 characters maximum and that those characters must be numbers
              >> between 0 and 9. To just limit the number of characters, don't set the
              >> "restrict" property.
              >>
              >> If you are drawing the textfield on the screen in authoring mode in Flash
              >> then
              >> in the Properties box there is a place labeled "Maximum Characters:".
              >> Just
              >> enter in the maximum number of characters there.
              >>
              >> Tim
              >>
              >
              >


              • 4. Re: restricting a text field
                TimSymons Level 1
                Dave,

                The only way to stop the textfield from autoscrolling when typing in text is to set a maximum number of characters. Your best bet to come up with a good size window to figure out how many characters your average user would need to use on a normal basis. Then type in that many "w" characters to see how large or small to make your textfield.

                Tim
                • 5. Re: restricting a text field
                  Level 7
                  Thanks Tim, it's a real shame that it has to be so, because you may find a
                  user gets half way along a line and the entry box just doesn't accept any
                  more characters, which in my mind won't look too great, but if that's the
                  way it is, that's the way it is!

                  Thanks

                  Dave

                  "TimSymons" <webforumsuser@macromedia.com> wrote in message
                  news:eidbsi$ac5$1@forums.macromedia.com...
                  > Dave,
                  >
                  > The only way to stop the textfield from autoscrolling when typing in text
                  > is
                  > to set a maximum number of characters. Your best bet to come up with a
                  > good
                  > size window to figure out how many characters your average user would need
                  > to
                  > use on a normal basis. Then type in that many "w" characters to see how
                  > large
                  > or small to make your textfield.
                  >
                  > Tim
                  >