hidding UISCrollBar when text field doesn't need to scroll

Hi,

I have made a dynamic text field and associated a UIScrollBar that scrolls the text when there is enough text to be scrolled. When there is no need for scrolling, the buttons and slider on the scroll bar disapear but the UIScrollBar stays visible which is very anoying. Is there a simple way to also make the UIScrollBar to disapear when there is no need for scrolling? I need to solution fast.

thanks
dmehranAsked:
Who is Participating?
 
Aneesh ChopraCommented:
Ok,
then you should use "onScroller" event, it works for dynamic text.

here is the code
----------
sBar._visible = false;
txtField.onScroller = function()
{
     if (this.maxscroll>1)
     {
          sBar._visible = true;
     } else
     {
          sBar._visible = false;
     }
};
-------------

Rgds
Aneesh
0
 
dmehranAuthor Commented:
oops, the title of this question should say 'UIScrollBar' and not 'UISCrollBar'. sorry ...
0
 
MontoyaProcess Improvement MgrCommented:
It can be done, but the easiest and fastest way is to just use the textarea component instead. It already has that functionality built-in.

0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Aneesh ChopraCommented:
Hi,

lets assume text instance name is "txtField" and 'UISCrollBar' instance name is "sBar"

then, here is the code
---------------
sBar._visible = false;
txtField.onChanged = function()
{
      if (this.maxscroll>1)
      {
            sBar._visible = true;
      } else
      {
            sBar._visible = false;
      }
};
-----------------

Rgds
Aneesh
0
 
dmehranAuthor Commented:
Hi, thanks for the answers, I probably had to be more specific about my question.  Aneesh, your code works when the text field is 'input text' and a user directly types in the text field. My situation is a little different in that my text field is 'Dynamic text' and I am wiritng messages into that text field programmatically. I should have explained that when I was rushing to post my question. In any event, what is the best way to show and hide a scroller on a dynamic text depending on the content of the text. I have not tried a text area component, Ill see if that works for me.

I will give partial points to the answer Aneesh presented so far in order to make thing fair. should have been more specific with my question.
0
 
Aneesh ChopraCommented:
here I have done a sample FLA exclusively for you
download link:
http://s46.yousendit.com/d.aspx?id=02URI3HKKMDBL0N4IOUGLN60FQ


Rgds
Aneesh
0
 
dmehranAuthor Commented:
thanks Aneesh. Unlike what I promissed earlier, I didn't see any point of giving partial points to your earlier solution.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.