I am trying to create a dynamic text field that continuously scrolls through dynamically loaded text (like a news ticker, except it scrolls down). If have got the text to load in, and I can get it to scroll with buttons, but I don't want it to use buttons. I just want it to scroll, and when it has scrolled through the text, I want it to wait for a little bit and then rescroll through it again. Do you know how I can do this with actionscript?
myFormat = new TextFormat();
myFormat.font = "Verdana";
myformat.embedFonts = true;
/*i'm not sure about how to embed a font... if you can't do it, don't ask me cause i don't know more then this
but i think it's like this: go to the library, on top, on the right, there is a button. in the popUp menu
choose new font. choose the font that you want,then assign it a name. that's the name wich will appear
here: myFormat.font = "font name";
to load the text dinamically use loadVariables():
important!: the text takes some time to load, so you have to be sure that the text has loaded that's why I use onData, but I've had some trouble with it, and there is a known issue about that
in the external.txt i placed: externalText=BEGINING and more garbish
*/
//
_root.createEmptyMovieClip("mc", 0);
_root.mc.loadVariables("external.txt");
_root.mc.onData = function() {
trace("jong");
_root.mc.createTextField("t", 0, 0, 0, 100, 100);
_root.mc.t.text = _root.mc.externalText;
_root.mc.t.wordWrap = true;
_root.mc.t.border = true;
};
//
function scrollDown() {
_root.mc.t.scroll = _root.mc.t.scroll%_root.mc.t.maxscroll+1;
if (_root.mc.t.scroll == _root.mc.t.maxscroll) {
clearInterval(firstInterval);
secondInterval = setInterval(wait, 3000);
}
}
firstInterval = setInterval(scrollDown, 1000);
function wait() {
clearInterval(secondInterval);
firstInterval = setInterval(scrollDown, 1000);
}
you are a genius mate. just one more thing - do you know how i can make this a html text field, and can i make the scroll run more smoothly rather than line by line? so it just looks like a motion tween sort of thing?