this.createTextField("theField_txt", 1, 0, 0, 200, 60);
theField_txt.border = true;
//d'avanti ogni frase devi mettere 'n' tranne il primo
theField_txt.text = "cosa\ncippa\nline\nline\nline\nline6\nline7\nline 8";
TextField.prototype.scrollDown = function(numLines) {
if (this.scroll + numLines < this.maxscroll) {
this.scroll += numLines;
} else {
this.scroll = this.maxscroll;
this.stopAutoScroll();
this.onBottomReached();
}
};
TextField.prototype.scrollUp = function(numLines) {
if (this.scroll - numLines > 1) {
this.scroll -= numLines;
} else {
this.scroll = 1;
this.stopAutoScroll();
this.onTopReached();
}
};
TextField.prototype.startAutoScroll = function(speed, numLines, dir) {
if (typeof speed == "number" && typeof numLines == "number") {
if (dir == "down") {
this.autoScroller = setInterval(this, "scrollDown", speed, numLines);
} else if (dir == "up") {
this.autoScroller = setInterval(this, "scrollUp", speed, numLines);
}
}
};
TextField.prototype.stopAutoScroll = function() {
clearInterval(this.autoScroller);
};
theField_txt.onBottomReached = function() {
this.startAutoScroll(100, 1, "up");
};
theField_txt.onTopReached = function() {
this.startAutoScroll(1000, 1, "down");
};
theField_txt.startAutoScroll(1000, 1, "down");