| maraudir |
11-21-2012 05:44 AM |
Adobe LiveCycle setTimeOut
I'm assuming this only happens in LiveCycle, but I am having issue with the setTimeOut and setInterval. Here is an example of the setTimeOut code
Code:
if (xfa.form.gameform.money_game.timer.rawValue === null){
xfa.host.messageBox("Input must be numeric.","Input", 3, 1);
}
else {
var enemytime = app.setTimeOut("xfa.form.gameform.money_game.start_time.enemy();",1000);
}
function enemy()
{
xfa.form.gameform.money_game.currentTime.execEvent("calculate");
if (xfa.form.gameform.money_game.endTime.rawValue <= xfa.form.gameform.money_game.currentTime.rawValue){
app.clearTimeOut(xfa.form.gameform.money_game.start_time.enemytime);
xfa.host.messageBox("Done","Done", 3, 1);
}
if (xfa.form.gameform.money_game.endTime.rawValue > xfa.form.gameform.money_game.currentTime.rawValue){
xfa.form.gameform.money_game.start_time.money();
xfa.form.gameform.money_game.currentTime.execEvent("calculate");
xfa.form.gameform.money_game.start_time.enemytime = app.setTimeOut("xfa.form.gameform.money_game.start_time.enemy();",1000);
}
}
function money()
{
if (xfa.form.gameform.money_game.giveclicksnum.rawValue < 8){
xfa.form.gameform.money_game.money_total_op.rawValue = xfa.form.gameform.money_game.money_total_op.rawValue + 500;
}
}
If the number of seconds is small enough, the script functions properly. Otherwise it will randomly stop working at different times. Not sure if there is something that would stop the script from executing?
|