I was wondering if someone has written some simple code to have a text field continuously scroll a text string of variable length across it. Any help would be greatly appreciated.
I stumbled across a piece of code that I modified to work on the Pronto that will simulated text being typed on the go (see below). The problem is that if the length of the text variable is longer than the text field, some of the characters simply do not get displayed. I am learning ProntoScript, but I am not quite at a level to figure this out yet. I would like this to display, if available, the severe weather info in my weather module. The module itself will be posted on this site once I have completed the coding and create some icons... screenshots to follow.
// Global variables
var max=0;
var wHeader = "Weather Warning: ";
var wText = "Severe thunderstorm watch in effect for Ottawa."
function textlist()
{
max= textlist.arguments.length;
for (i=0; i this[i]=textlist.arguments[i];
}
tl=new textlist(wHeader + wText);
var x=0; pos=0;
var l=tl[0].length;
function textticker()
{
CF.widget("test").label=tl[x].substring(0,pos)+"_";
if(pos++==l)
{
pos=0;
Activity.scheduleAfter(1000, textticker);
x++;
if(x==max)
x=0;
l=tl[x].length;
} else
Activity.scheduleAfter(50, textticker);
}
textticker();
Last edited by ScottGrimes on June 3, 2010 10:06.