CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript frameworks (http://www.codingforums.com/forumdisplay.php?f=62)
-   -   Adobe LiveCycle setTimeOut (http://www.codingforums.com/showthread.php?t=282664)

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?

maraudir 11-21-2012 06:47 AM

I have found that if I open the Acrobat JavaScript debugger and run through each function, the program counts down as intented. If I close the debugger and run the program it still runs like it should. What could cause this to happen?


All times are GMT +1. The time now is 10:22 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.