These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

----> Acroforms : Count Down Timer Doubt ! <----

samsung
Registered: Feb 12 2008
Posts: 5
Answered

Hello,

I am learning javascript in acroforms and I would like your help on three problems I am facing.

I am experimenting with the PDF file released on internet to explain the article "JavaScript Clock/Timer Demo" published by Tom Parker. (Download Below)
http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/date_time_part3/JavaScriptClock.pdf

As an exercise for myself, I changed the javascript code in the COUNT DOWN TIMER section, so as the user would not need to enter the count down time by pressing buttons. In this case, I set the clock to 15 seconds -> 00:00:15:00. I also changed the PDF to start at full view by using the code app.fs.isFullScreen = true;

So, I would like now to implement the following :

a) When the user presses the "start count down time" button (located in page 1) and the time, after 15 seconds expires, the page would change automatically to page number 12. So, what code to use to accomplish this and where I would need to place it ?

b) I have observed that if you duplicate the Text field "count down time" which begins at 00:00:15:00 over several pages, when you press "start count down time" button, you will see that the pointer of the mouse keeps flashing at each millisecond and it changes the appearance from arrow to "hourglass with a calculator"

So, is there a way round to eliminate this annoying flashing?

c) Supposing that my PDF is in full screen view and that it has many pages (the user can go forward and backwards by pressing buttons), I would like to prevent the scrolling of the mouse wheel to act as a button (scrolling the mouse wheel would do nothing). In addition, I know that the navigation behavior via clicks on the left and right button in full screen mode is set by preferences but we cannot change another user's preferences.

So, programmatically, how can I prevent the scrolling AND the right/left clicks to act as forward/backward buttons? where should I place the javascript codes?

Thank you really much for you time in solving my doubts !

Maleck

My Product Information:
Acrobat Pro 7.0.9, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
>>a) When the user presses the "start count down time" button (located in
>> page 1) and the time, after 15 seconds expires, the page would change
>> automatically to page number 12. So, what code to use to accomplish this
>> and where I would need to place it ?You can change pages with this line of code:

this.pageNum += 1; Advance page number

The clock code runs on a timer. The timer executes some code that manages the count down. Find this code, and find the location where it terminates the count down. This is where you would place the page change code.

The count down timer is very complex because of the display and the controls. You may need something much simpler, so there is a lot of code you can cut out.

>>b) I have observed that if you duplicate the Text field "count down time"
>> which begins at 00:00:15:00 over several pages, when you press "start
>> count down time" button, you will see that the pointer of the mouse keeps
>> flashing at each millisecond and it changes the appearance from arrow
>>to "hourglass with a calculator"It's doing this because the system is overburdened with calculation scripts. By duplicating the field you are duplicating whatever is in the field's scripts. If all you want is the same value, then give the copied field the same name, this causes the value to be copied over, and doesn't repeat the calculations. If you want duplicate functionality you'll need to rearrange the code to get the best performance.

>>So, programmatically, how can I prevent the scrolling AND the right/left
>> clicks to act as forward/backward buttons? where should I place the
>> javascript codes?You can't, at least not the scrolling bit. But take a look at the properties for the "FullScreen" object in the Acrobat JavaScript Reference. There are lots of parameters in here for controling full screen, including a timer for advancing pages.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

samsung
Registered: Feb 12 2008
Posts: 5
Thanks a lot !

I have carefully checked all the codes and made the implementations. Now everything is running smoothly.

Maleck