ActionScript 2.0 Components Language Reference |
|
|
|
| UIScrollBar Component > UIScrollBar._targetInstanceName | |||
Flash Player 6 (6.0.79.0).
Flash MX 2004.
scrollBarInstance._targetInstanceName
Property; indicates the instance name of the text field associated with a UIScrollBar component. This property can be tested and set. However, it should not be used to create an association between a text field and a scroll bar. Use UIScrollBar.setScrollTarget() instead.
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");
|
|
|
|