User Guide
UIScrollBar._targetInstanceName 1411
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
trace() function to display the value of the
targetInstanceName property.
/**
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);
trace(my_sb._targetInstanceName);
// 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);
// Set scroll properties.
my_sb.setScrollProperties(10, 0, 99);
// 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;
my_txt.condenseWhite = true;
} else {
my_txt.text = "Error loading text.";
}
};
my_lv.load("http://www.helpexamples.com/flash/lorem.txt");