UIScrollBar component
The UIScrollBar component allows you to add a scroll bar to a text field. You can add a scroll bar
to a text field while authoring, or at runtime with ActionScript.
The UIScrollBar component functions like any other scroll bar. It contains arrow buttons at
either end and a scroll track and scroll box (thumb) in between. It can be attached to any edge of
a text field and used both vertically and horizontally.
Using the UIScrollBar component
To use the UIScrollBar component, verify that object snapping is turned on (View > Snapping >
Snap to Objects). Then create a text input field on the Stage and drag the UIScrollBar component
from the Components panel to any quadrant of the text field's bounding box.
If the length of the scroll bar is smaller than the combined size of its scroll arrows, it will not be
displayed correctly. One of the arrow buttons will become hidden behind the other. Flash does
not provide error checking for this. In this case it is a good idea to hide the scroll bar with
ActionScript. If the scroll bar is sized so that there is not enough room for the scroll box (thumb),
Flash makes the scroll box invisible.
Unlike many other components, the UIScrollBar component can receive continuous mouse
input, such as when the user holds the mouse button down, rather than requiring repeated clicks.
There is no keyboard interaction with the UIScrollBar component.
UIScrollBar parameters
You can set the following authoring parameters for each UIScrollBar instance in the Property
inspector or in the Component inspector:
_targetInstanceName
component is attached to.
horizontal
indicates whether the scroll bar is oriented horizontally (
The default value is
You can write ActionScript to control these and additional options for a UIScrollBar component
using its properties, methods, and events. For more information, see
on page
833.
Creating an application with the UIScrollBar component
The following procedure explains how to add a UIScrollBar component to an application while
authoring.
To create an application with the UIScrollBar component:
Create a text input field and give it an instance name in the Property inspector. Add enough
1.
text to the field so that users will have to scroll to view it all.
In the Property inspector, set the Line Type of the text input field to Multiline, or Multiline No
2.
Wrap if you plan to use the scroll bar horizontally.
indicates the name of the text field instance that the UIScrollBar
.
false
CHAPTER 6
Components Dictionary
) or vertically (
true
"UIScrollBar class"
UIScrollBar component
).
false
829
Need help?
Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?
Questions and answers