Expand my Community achievements bar.

setTimeOut not working after 8 seconds

Avatar

Former Community Member

After using the following code;

function TimedOut() {

xfa.host.messageBox("Done waiting " + xfa.form.gameform.money_game.timer.rawValue + " seconds.","Timer",3,0);

}

//prompt for number of seconds

var secondCount = xfa.host.response("Enter number of seconds", "Number of Seconds", "", "")

//start counter

if (secondCount >= 0)

//timer set for thousandths of a second

app.setTimeOut("xfa.form.gameform.money_game.start_time.TimedOut();", 1000*secondCount);

I am able to get the message to appear after  an input of 8 seconds or less but no longer than that.

I tried another variation of grabbing the current time and the amount of time I wanted to wait and then executing this code(grabbing two hidden fields for the values of currentTime and timeAtClick);

xfa.form.gameform.money_game.timeAtClick.execEvent("calculate");

var endTime = parseInt(xfa.form.gameform.money_game.timeAtClick.rawValue) + parseInt(xfa.form.gameform.money_game.timer.rawValue);

var currentTime = 0

while (currentTime < endTime) {

     xfa.form.gameform.money_game.currentTime.execEvent("calculate");

     currentTime = parseInt(xfa.form.gameform.money_game.currentTime.rawValue);

}

xfa.host.messageBox("Done waiting " + xfa.form.gameform.money_game.timer.rawValue + " seconds.","Timer",3,0);

That works but causes the entire page to wait(lockup) until the elapsed time.  That's not what I want.  I want to be able to continue doing things on the form and then have a message pop up stating the alloted time has expired.  Any idea?

0 Replies