Problem:
I want to loop through something, say, 5 times. Each iteration requires the counter to be used. I can use a for loop to accomplish this task. Now, suppose I want to do the same thing, but I need to pause for a second between each attempt--or start each attempt on one second intervals.
What I've tried:
I have tried the following code in the click event for a button:
var s = tfExample.rawValue;
for (var i = 0; i<s.length; i++){
app.setTimeOut("xfa.form.form1.variables.scripts.check(i)",1000);
}
And this is the code listed in scripts:
function check(i){
p1.tfCounter.rawValue = i;
p1.tfBefore.rawValue = s.substr(0,i);
p1.tfCurrent.rawValue = s.substr(i,1);
p1.tfAfter.rawValue = s.substr(i+1);
}
When I use this code, and preview in LC, LC just kind of stutters and does nothing; reader does nothing at all; and Acrobat throws an error:
ReferenceError: i is not defined
1:Doc:Exec
I presume that the "1" means line 1 from the source. That line is tfCounter.rawValue = i;. So, it looks to me like it is defined as it is declared in the function definition as a passed variable. I can't find any other mention of functions that shows using check(var i) or something to that effect in LC documentation. Any ideas?
I should probably also mention that I have tried putting that code in the same event with the button, and it doesn't work there, either. It's a different error message.
Message was edited by: jasotastic81: added other thing I've done and corrected a typo.