I'm using Javascript within a PDF editor.
I'm using this reference https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_api_reference.pdf
I'm trying to set an action on a field when a mouseEnter event is triggered on that field. Below is my code.
var myDoc = app.newDoc(); // Create a blank doc
var Bbox = myDoc.getPageBox("Crop"); // Get crop box
var inch = 72;
// Add a text field at the top of the document
var f = myDoc.addField("Name.Last", "text", 0,[ inch, Bbox[1]-inch, 3*inch, Bbox[1]- inch - 14 ] );
f.setAction("MouseEnter", "f.textColor = color.yellow"); // Add an action
However i get the following error:
======== Field : mouse enter ========
[ Line: 00000 { ReferenceError } ] : f is not defined
I thought i had defined the field f using this line here:
var f = myDoc.addField("Name.Last", "text", 0,[ inch, Bbox[1]-inch, 3*inch, Bbox[1]- inch - 14 ] );
Why is the error saying my field is not defined?