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

Show or hide a layer based on the state of a checkbox

jayw
Registered: Jul 28 2009
Posts: 8

Hi Everyone,
I thought this would be so simple when I started this project and I have been working on it for days now and cant get anything to work. First off I am a designer not a programmer so if we have to code I'll need baby steps :)

Here is what I am trying to do. I have a acrobat file that allows users to configure a "widget" each part of the widget is on a layer, I need to use the checkbox to turn on a layer if the box is checked (that was easy) the trick is to turn it back off if the box is unchecked. Basically I need the checkbox to function like the eyeball icon in the layers pallet. That way when the form is viewed/printed there is a list down the right with all the parts used checked and a diagram on the left that shows the complete widget.

I hope that makes sense.
Thanks
Jay

My Product Information:
Acrobat Pro 9.1.1, Macintosh
suewhitehead
Registered: Jun 3 2008
Posts: 232
What is the script you are using to turn on your layer? That may help us understand what you are doing more clearly. What is confusing me is the use of the word "layer".
jayw
Registered: Jul 28 2009
Posts: 8
I was not using a script, I was using the "check box properties" under the "actions" tab On Mouse Up/Set Layer visibility. That works great to turn on a layer but then you are stuck with it. If you have any ideas on how to do this with a script I'd love to learn how, (but I have never worked with scripts)
Thanks
Jay
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi jayw,

I think the only way to do this is with a script. Have you seen this article in the Learning Center-
http://www.acrobatusers.com/tutorials/2006/create_use_layers

The sample download shows layers turning on and off using a timer but should be able to be added to a checkbox mouse down action.

Hope this helps,

Dimitri
WindJack Solutions
www.pdfscripting.com
www.windjack.com
jayw
Registered: Jul 28 2009
Posts: 8
Hi Dimitri,
I saw that tutorial and it really just covers creating the layer and displaying it in the layers pallet (at least that is all I got out of it). I've got the layers created I just need a way to turn them off and on within the document. Maybe I should use something other than the check box, like a invisible click-able area and then the actual check artwork on the layer that is displayed then another click-able area on that layer that turns it back off... humm... that might work. anyone out there got any other ideas?
Thanks Again
Jay
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi jayw,

So you downloaded the sample file that is included as a link in that article? The file has code you can examine for turning on and off layers from a button action on the form, not using the layers pallette. It isn't an exact solution for you, you will have to alter the code for your particular case but it does show turning layers on and off.

Hope this helps,

Dimitri
WindJack Solutions
www.pdfscripting.com
www.windjack.com