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

Scripting - add action to a button

Explorer ,
Feb 27, 2021 Feb 27, 2021

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
999
Translate
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

Community Expert , 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.

Translate
Community Expert ,
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.

Translate
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
LATEST

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

Translate
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