0
votes

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.

3

3 Answers

1
votes

add a conditional to hide it when tf.textHeight > tf.height

1
votes

// after updating the text...

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;
}
0
votes

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.