Skip to main content
HSS Sursee
Known Participant
Jul 12, 2023 2:52 PM UTC
Question

Deactivate buttoon after action has been triggered

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 is closed to new replies. Start a new post to keep the conversation going.

    9 replies

    kglad
    Community Expert
    Community Expert
    Jul 12, 2023 3:02 PM UTC

    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.

    Translate
    HSS Sursee
    Known Participant
    Jul 12, 2023 3:24 PM UTC

    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?

    Translate
    kglad
    Community Expert
    Community Expert
    Jul 12, 2023 3:30 PM UTC

    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;

    }

    Translate