
Код:
var _txt:TextField = _root.createTextField("_txt", 0, 5, 5, 200, 200);
with (_txt) {
border = true;
borderColor = 0;
}
var _str:String = "Test text\rTest line\r";
for (i=0; i<5; i++) {
_str += _str+i;
}
_txt.text = _str;
// Поместить в библиотеку клип небольшого размера, присвоить идентификатор экспорта scroller
var scroller:MovieClip = _root.attachMovie("scroller", "scroller", 2, {_x:_root._txt._width+5, _y:5});
scroller.onPress = function() {
if (this.m_y == undefined) {
this.m_y = this._y;
this.n_y = _root._txt._height+_root._txt._y-this._height;
this._step = this.n_y/_root._txt.maxscroll;
}
this.a_y = this._ymouse;
this.onEnterFrame = function() {
this._y += this._ymouse-this.a_y;
if (this._y<this.m_y) {
this._y = this.m_y;
}
if (this._y>this.n_y) {
this._y = this.n_y;
}
_root._txt.scroll = this._y/this._step;
};
};
scroller.onRelease = function(){
delete this.onEnterFrame;
}
scroller.onReleaseOutside = scroller.onRelease;