I am creating a horizontal text scroller using the kirupa tutorial here http://www.kirupa.com/developer/actionscript/tween.htm my problem is I want it to scroll in an endless loop, and i’m stuck.
here’s the code
import mx.transitions.Tween;
import mx.transitions.easing.*;
loc1 = 708;
loc2 = 60/2;
_root.createEmptyMovieClip("scroll_mc", 0);
with (_root.scroll_mc) {
moveTo(0, 0);
lineTo(Stage.width, 0);
lineTo(Stage.width, Stage.height);
lineTo(0, Stage.height);
endFill();
createEmptyMovieClip("scrollMask",3);
with(scrollMask){
moveTo(108,21);
beginFill(0x000088);
lineTo(708,21);
lineTo(708,60);
lineTo(108,60);
endFill();
}
createTextField("scrollText",2,loc1,loc2,10,10);
with(scrollText){
setMask(_parent.scrollMask);
autoSize = true;
textStr = " | ";
for (var i = 0; i < (_global._data.length - 1); i++) {
textStr = textStr + _global._id* + ": " + _global._data* + " | ";
}
text = textStr;
}
//create the tween
var xPosT:Tween = new Tween(scrollText, "_x", Regular.easeOut, loc1, (0-scrollText.textWidth), (scrollText.textWidth * 1), false);
xPosT.onMotionFinished = function() {
trace("stopped");
};
}