Stop action if trigger is clicked a second time


(Lesley Piercefield) #1

Is there a way to stop an action from triggering if the trigger is clicked more than once? I need an action to happen only on the first click. I can’t just have 2 triggers on top of each other and hide one because the one the top blocks the mouse over action.


#2

what about moving the 2nd trigger over after the click. So, have a second element off scene and move it over after you click on the trigger the first time.

Another option would be to run a javascript function that checks a condition … say if a variable is true or false then disable the click. One way to do it is to add a class to the element and then check if it has that class and immediately return…

if (element.classList.contains("clicked")){
	return;
} else {
    // add your action here
    //--> example: hypeDocument.showNextScene... or hypeDocument.startTimelineNamed...
	element.classList.add("clicked");
}

(Lesley Piercefield) #3

thank a lot didn’t think of this :grinning: