Debugging A Runtime Error - Adobe 12001196 - Acrobat - Mac Manual

Javascript
Hide thumbs Also See for 12001196 - Acrobat - Mac:
Table of Contents

Advertisement

Acrobat JavaScript Debugger
3
Exercise: Calculator
5. Summarize your findings.
From the above, note that:
– Button values display correctly. Clicking 9 displays 9, clicking 3 displays 3, and so forth
– Function strings display correctly in the Func field. Clicking *, -, +, and so forth
– Click Equals (=). In most cases, results are incorrect.
– Assumption: There is at least one runtime error in the code. Something isn't working

Debugging a runtime error

1. Click C to Cancel and clear the calculator display to zeros, if necessary.
2. Select Advanced > JavaScript > Debugger to display the debugger dialog.
3. In the Scripts window, navigate to the Document script Mult, and set a breakpoint at the
call to func_button(MULT);
4. In the Inspect details window, create a watch for entry and accum.
At this point both variables have the value 0.???
5. Click Quit to close the debugger.
6. Enter the expression 9 * 3 on the calculator pad.
The debugger executes up to the breakpoint.
7. Click Step Into (single step) to execute the first statement in func_button().
8. Single Step two more times.
This statement contains an error.
accum == entry; \\ This is incorrect.
The statement should assign the value of entry to accum. Executing this statement
does not update accum. See the watches in
9. You can either click Edit to correct the error or you can click Step Out to end the session.
Clicking Edit to correct the error causes the debugger to display this message:
Clicking Yes enters the editor where you can correct the error. Change == to =.
N
O T E
Alternately, you can click Step Out to end the debugger session. Then correct the error
in the editor and click Quit.
10.Clear the calculator display.
50
in the Display field.
displays the correct function string.
correctly between the value of the entry and accum variables.
If you edit the file, the debugger session will stop. Would you like to edit the file
anyway?
You will still need to clear the breakpoint. You can quit the debugger, execute the
:
calculator again to the breakpoint and clear it.
Figure
3.10.
Acrobat JavaScript Scripting Guide

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Acrobat 6.0

Table of Contents