Skip to main content
HSS Sursee
Known Participant
July 12, 2023
Question

Deactivate buttoon after action has been triggered

  • July 12, 2023
  • 1 reply
  • 275 views

I am building a Network as a HTML-File. The network is built step after step until it's finished. Sometimes it's needed to click on a point multiple times. My solution for that was, that I made a new smaller button for the next step. Now if I click on some buttons some steps which are already built in the network show up (the smaller buttons). Is there a way to deactivate an action after it has been triggered?

 

Thank you in advance for all the Help.

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    July 12, 2023

    you can make the button not visible, remove the event listener, you can assign the mouseEnabled property to false, you can use a toggle in the listener function etc.

    HSS Sursee
    Known Participant
    July 12, 2023

    I am working with the visible propert for it and I don't have any experience with your other mentioned solutions.

     

    Maybe my idea of how I want it to work helps.

    If I click on button A --> button B gets visible

    If I click on button A --> button B becoms invisible and button C gets visible

    Now if I click on button A again, button B gets visible again but I don't want that because button C is already visible

     

    Is there a option, that after the button has been clicked it gets inactive until turned back on?

    kglad
    Community Expert
    Community Expert
    July 12, 2023

    you would encode what you want. eg, to start with buttonA visible and buttonB not visible and then change that after buttonA is clicked:

     

    this.buttonB.visible=false;

    this.buttonA.addEventListener("click",aF.bind(this));

    function aF(){

    this.buttonA.visible = false;

    this.buttonB.visible = true;

    }