Skip to main content
Inspiring
November 2, 2006
Question

restricting a text field

  • November 2, 2006
  • 3 replies
  • 376 views
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


This topic has been closed for replies.

3 replies

Inspiring
November 2, 2006
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
>>
>
>


Participating Frequently
November 2, 2006
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
Inspiring
November 2, 2006
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
>


Participating Frequently
November 2, 2006
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