The return value of this method must be held in a JavaScript variable. Otherwise, the interval object is subject to garbage-collection, which would cause the clock to stop.Note: Beginning with Acrobat 7.05, an interval is automatically terminated when the document whose script called setInterval is closed (assuming it was not previously terminated).Opening and closing the document JavaScripts dialog box causes the JavaScript interpreter to re-read the document JavaScripts and consequently to re-initialize any document-level variables. Resetting document-level variables in this way after JavaScript expressions have been registered to be evaluated by setInterval or setTimeOut may cause JavaScript errors if those scripts use document-level variables.
An interval objectfunction DoIt() {var f = this.getField("Color");var nColor = (timeout.count++ % 10 / 10);// Various shades of red.var aColor = new Array("RGB", nColor, 0, 0);f.fillColor = aColor;}// save return value as a variabletimeout = app.setInterval("DoIt()", 1000);// Add a property to our timeout object so that DoIt() can keep// a count going.timeout.count = 0;See setTimeOut for an additional example.
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/JS_API_AcroJS.88.165.html