A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How to detect length of text in dynamic text field?

  1. #1
    Junior Member
    Join Date
    Apr 2001
    Posts
    4

    How to detect length of text in dynamic text field?

    Hi,

    I've got a movie clip containing a dynamic text field and two buttons used to scroll the text up and down inside the movie clip. The text is loaded dynamically from a database.

    Now, I want to hide the scroll buttons if the loaded text fits inside the dynamic text field without scrolling. How can I detect whether the text fits or not?

    Grateful for any help!

    //Mans

  2. #2
    feeling froggy
    Join Date
    Jul 2002
    Posts
    179
    textboxes have a property called 'maxscroll' if it is set to 1 then it fits; if it is greater than 1 it scrolls. so you can do somethign like this:
    code:

    _root.scrollbar1._visible = (_root.txtBox.maxscroll > 1);


  3. #3
    Junior Member
    Join Date
    Apr 2001
    Posts
    4
    Thanks, that worked like a charm!

  4. #4
    Junior Member
    Join Date
    Apr 2003
    Posts
    27
    now i'm the one with same problem.. that seems to work only for 2 possibilites:
    if there's text (even in a lengh that doesn't need to be scrolled; (maxscroll = 1)
    if there isn't text at all; (maxscroll = 0)
    But i want tha scrollbar to stay invisble if there is short text that doesn't need to be scrolled.

    Thank you in advance

    EDIT: i've realized by now that i always get MAXSCROLL = 1 even if nothing is loaded!....
    Last edited by light_in_tunel; 08-30-2006 at 10:14 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center