Код AS3:
package {
import flash.display.MovieClip;
import flash.text.TextField;
import fl.controls.UIScrollBar;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class Main extends MovieClip {
private var _textfield : TextField = new TextField();
private var _scrollBar : UIScrollBar = new UIScrollBar();
private var _timer : Timer = new Timer(100);
public function Main() {
addChild(_textfield);
addChild(_scrollBar);
_textfield.width = 200;
_textfield.height = 200;
_textfield.multiline = true;
_textfield.wordWrap = true;
_scrollBar.height = _textfield.height;
_scrollBar.x = _textfield.x + _textfield.width;
_scrollBar.scrollTarget = _textfield;
_timer.addEventListener(TimerEvent.TIMER, timerEventHandler);
_timer.start();
}
private function timerEventHandler(event : TimerEvent):void{
var timer : Timer = event.currentTarget as Timer;
_textfield.appendText("currentCount : " + timer.currentCount.toString() + "\n");
_scrollBar.update();
_textfield.scrollV = _textfield.maxScrollV;
}
}
}