User Guide
UIScrollBar.setScrollTarget() 1409
UIScrollBar.setScrollTarget()
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
scrollBarInstance.setScrollTarget(textInstance)
Parameters
textInstance The text field to assign to the scroll bar.
Description
Method; assigns a UIScrollBar component to a text field instance. If you need to associate a
text field and a UIScrollBar component at runtime, use this method.
Example
The following example creates a scroll bar to scroll text in a text field, which it loads from a
web page. The example calls the
setScrollTarget() method to associate the scroll bar
my_sb with the text field my_txt.
/**
Requires:
- UIScrollBar component in library
*/
this.createTextField("my_txt", 10, 10, 20, 200, 100);
my_txt.wordWrap = true;
this.createClassObject(mx.controls.UIScrollBar, "my_sb", 20);
// Set the target text field.
my_sb.setScrollTarget(my_txt);
// Size it to match the text field.
my_sb.setSize(16, my_txt._height);
// Move it next to the text field.
my_sb.move(my_txt._x + my_txt._width, my_txt._y);
// Scroll 2 lines per click of scroll arrow.
my_sb.lineScrollSize = 2;
// Scroll 5 lines per click of scroll track.