Scripting - add action to a button

Explorer ,
Feb 27, 2021 Feb 27, 2021

Copy link to clipboard

Copied

Hello,

 

I need help with writing script, that can assign an action (of show/hide button) to a button. It is supposed to go like this:


For this button

    add action -> show/hide button

       and  hide these set of buttons (which are just selected from the layer panel or from page)

 

Is it possible, in same script as selection of buttons is involved twice? Also please suggest a way to extend it in a way that an action of show/hide to certain buttons, can be applied to entire array of buttons.

 

Thanks in advance!

TOPICS
Scripting

Views

72

Likes

translate

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

correct answers 1 Correct Answer

Adobe Community Professional , Mar 01, 2021 Mar 01, 2021
Look for showHideFieldsBehavior property of the button object. For instance, given two buttons, myButton and myOtherButton, the following code hides myOtherButton, and sets the behaviour of myButton to show myOtherButton when you roll over myButton: myButton.showHideFieldsBehaviors.add ({ enableBehavior: true, behaviorEvent: BehaviorEvents.MOUSE_ENTER, fieldsToShow: myOtherButton }); myOtherButton.hiddenUntilTriggered = true; P.

Likes

translate

Translate

Translate
Adobe Community Professional ,
Mar 01, 2021 Mar 01, 2021

Copy link to clipboard

Copied

Look for showHideFieldsBehavior property of the button object. For instance, given two buttons, myButton and myOtherButton, the following code hides myOtherButton, and sets the behaviour of myButton to show myOtherButton when you roll over myButton:

myButton.showHideFieldsBehaviors.add ({
  enableBehavior: true,
  behaviorEvent: BehaviorEvents.MOUSE_ENTER,
  fieldsToShow: myOtherButton
});

myOtherButton.hiddenUntilTriggered = true;

P.

Likes

translate

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
Explorer ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

Thank you very much! That's exactly what i needed!

Likes

translate

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