Here's a simple clock updated per second in a static text field.
----- form1::docReady - (JavaScript, client) ---------------------
timer1 = app.setInterval('xfa.form.form1.MYSO.doit();',1000);
MYSO is "title" given to a script object created by right-clicking on form1 and creating a script object. timer1 is not var-ed so that it's global.
----- form1.#variables[0].MYSO::MYSO - (JavaScript, client) --------
function doit()
{
//xfa.host.messageBox("doing it..");
var d = new Date();
var s = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
xfa.form.form1.Content.StaticText1.rawValue = s;
}
Note, full path to wherever your static text field is (resolveNode may be too slow for timers), you can have it inserted for you by Ctrl-click on your field.
Kill timer (doesn't work switching from preview to design)
----- form1::docClose - (JavaScript, client) --------------------
app.clearInterval(timer1);
------------------
Ok that should get you going... btw, recursive setTimeOut seems unreliable and can die.
BTW, Adobe's usurpation of the javascript namespace is mind-boggling.
Should have direct access to javascript without the rewrap.
"everybody wants to rule the world..."