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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dmehranAuthor Commented:
oops, the title of this question should say 'UIScrollBar' and not 'UISCrollBar'. sorry ...
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.

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
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Aneesh ChopraCommented:
here I have done a sample FLA exclusively for you
download link:
http://s46.yousendit.com/d.aspx?id=02URI3HKKMDBL0N4IOUGLN60FQ


Rgds
Aneesh
dmehranAuthor Commented:
thanks Aneesh. Unlike what I promissed earlier, I didn't see any point of giving partial points to your earlier solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.