ActionScript 2.0 Components Language Reference |
|
|
|
| UIScrollBar Component > UIScrollBar.pageScrollSize | |||
Flash Player 6 (6.0.79.0).
Flash MX 2004.
scrollBarInstance.pageScrollSize
Property; gets or sets the number of lines or pixels scrolled when the user clicks the track of the UIScrollBar component. If the scroll bar is oriented vertically, the value is a number of lines. If the scroll bar is oriented horizontally, the value is a number of pixels.
You can also set this value by passing a pageSize parameter with the UIScrollBar.setScrollTarget() method.
The following example creates a scroll bar to scroll text in a text field that it loads from a web page. The example sets the pageScrollSize property to scroll five lines of text each time the user clicks the scroll track:
/**
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.
my_sb.pageScrollSize = 5;
// Load text to display and define onData handler.
var my_lv:LoadVars = new LoadVars();
my_lv.onData = function(src:String) {
if (src != undefined) {
my_txt.text = src;
} else {
my_txt.text = "Error loading text.";
}
};
my_lv.load("http://www.helpexamples.com/flash/lorem.txt");
|
|
|
|