Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

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
0
dmehran
Asked:
dmehran
  • 3
  • 3
1 Solution
 
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
 
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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:
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
 
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now