Autohide UIScrollBar in AS3

I have a dynamic text box in a Flash AS3 project. I've attached a UIScrollBar component to it which works great if there's more text than display room.

I want to be able to hide the scrollbar when there's more display room than text. I can't seem to find anything about it in AS3. Does anyone know the property I should be looking for to see if the scrollbar should be displayed or not?

Thanks, Ryan.


tf.textHeight > tf.height时添加一个条件来隐藏它


//更新文字后...

my_textfield.scrollV = 0; // reset the scroll to the top
my_scrollbar.update(); // make sure the scrollbar knows it's been changed
if (my_textfield.maxScrollV <= 1) {
    my_scrollbar.visible = false;
} else {
    my_scrollbar.visible = true;
}

just set the visible property of the UIScrollBar to false when not required. For eg :

scrollBar.visible = textbox.text.length < MaxLength ? false:true;

where

  • scrollBar : The instance name of UI Component u added.
  • textBox : The instance name of textbox.
  • MaxLength : The integral length beyond which scollBar should be made visible.
  • 链接地址: http://www.djcxy.com/p/17850.html

    上一篇: Flash CS4图像推子问题

    下一篇: 在AS3中自动隐藏UIScrollBar