• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Im trying to create a button that opens/closes a picture

New Here ,
Aug 10, 2021 Aug 10, 2021

Copy link to clipboard

Copied

I have an architectural floor plan that I would like to add buttons to that open/close different elevations (pics) throughout the project. I want each button to open/close its own corresponding picture.

TOPICS
How to

Views

187

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 10, 2021 Aug 10, 2021

Copy link to clipboard

Copied

Im currently using Acrobat XI

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 10, 2021 Aug 10, 2021

Copy link to clipboard

Copied

You can use image field to add image and then use script in button to show/hide that field.

As Mouse UP event of button add this and replace picture field name to your field name:

if(this.getField("Picture_af_image").display == display.visible)
this.getField("Picture_af_image").display = display.hidden;
else this.getField("Picture_af_image").display = display.visible;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 10, 2021 Aug 10, 2021

Copy link to clipboard

Copied

Thanks for your response. However, Im am brand new to scripting and unfamiliar with this process.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 10, 2021 Aug 10, 2021

Copy link to clipboard

Copied

LATEST

You have everything you need above. You just need to change the field name, between the quotes.

To make it a bit more compact, and so that you only have to enter the field name once, use this version of that code:

 

// Change "Picture_af_image" below to the name of your actual field
var imageFieldName = "Picture_af_image"; 
var f = this.getField(imageFieldName);
if(f.display == display.visible)
f.display = display.hidden;
else f.display = display.visible;

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines