Expand my Community achievements bar.

Turning layers on and off with buttons....

Avatar

Level 1

I have created a PDF that contains some 3D content, and am trying to control layer visibility with buttons, and pull down menus.

Is it possible to have pull down menus and buttons control the visability of layers?

If so...please explain how...I am brand new to LC and am having trouble getting things to work

Thanks!

Dean

6 Replies

Avatar

Level 1

Thanks for the link to the tutorial. This gets me half a step closer. Tim Huff is hiding image boxes. I need to show and hide layers in the Scene Tree. I don't know anything about scripting. Is this possible? I would think it should be...just don't know where to begin.

TIA

Dean

Avatar

Level 1

Yes it is possible to do with JavaScript. I have a document that hides and shows pages as well as subforms in my document I am using checkboxes and sometimes dropdowns to do the hiding and showing. Its kind of hard for me to explain, if you have the file attached to the thread I can look at it and possibly help. If not I can try to maybe paste code with instructions on how to use it.

Avatar

Level 1

UsualoO,

Thanks for the reply and willingness to help! I have attached a PDF with the interface we are wanting to use...its a work in progress. I tried to output a PDF with the actual geometry, but the filesize was over the 5 meg limit, so I deleted all the original geometry and created 3 different primitives.

If you click the "Model Tree On/Off" radio button, you will see there are 3 layers. Each of the layers have a different primitive. Each of these layers represent a different "Weatherhood".  I will have to set up a different drop down menu for each of the other buttons..."Filter", "Heating", ect.

My end goal is to be able to select (in the drop-down menu) which weatherhood to show on the model. Then, depending on which weatherhood they choose, have the radio buttons on the lower left part of the PDF display options for the specified weatherhood.

Again, Thanks for any help you are willing and able to provide!!!


Dean

Avatar

Level 1

Now please understand I am by no means a coding expert. This is just what I used after combing the forums and failing miserably many times. There may be a better way of doing what you need, however this is how I got it to work. I use an "If, else if" statement. I can't open your file, so I will just try to explain how the code I am pasting here should work.

I have this code on a drop down list for state specific information. It makes certain subforms on my front page show when the appropriate state is selected. Within those subforms are radio buttons as well as buttons for hiding/showing pages and linking to those pages.

I put the following code on the exit event of the drop down as well as the initialize (because the options need to stay visible on reopen of the form) Your document may not need to be this complex, I am just trying to give you information I wish someone had given me when I was green!! Please note that I have the values of the dropdown in state abbreviation form "AL", "AK" etc. I think the default is to have it numerically, but I changed it so the code was a little less difficult to read. (FYI: if you use this kind of idea for your document and add selections to your drop down in the future, remember to check the "Object > Binding" tab for the values. If you add information at a later date it gives the new info the next sequential number as a value which will throw your code off.) Here is how the code should look, and note that this dropdown will have 50 sections since it is for a state drop down box, but I only listed a few so you get the general idea.

if(headlineState.rawValue == "AL"){

     forms.UMUIM.presence ="visible";

}

else if(headlineState.rawValue == "AK"){

     forms.UMUIM.presence="visible";

     forms.PIP.presence="visible";

}    ......and so on till all values are included

else{

     forms.UMUIM.presence="hidden";

     forms.PIP.presence="hidden";

}

The

"headlineState" is my drop down

"forms" is a subform

     -"UMUIM" and "PIP" are subforms within the "forms" subform.

I know this is probably confusing, I know I had no clue what I was doing at first either, but you just have to kind of dive in and through trial and error figure JavaScripting out. I hope this helped some. Let me know if this is uber confusing or if after you try it with your document it still isn't working and I can try to help a bit more!

Avatar

Level 10

I don't know if it will help, but at the Acrobat User Community site there is a gallery of interactive geospatial and mapping pdfs, there might be something in there that could help.

http://www.acrobatusers.com/gallery/geospatial