Multiple correct quiz

I have created 2 symbols within the hype doc. The first has 2 correct answers and the second three correct answers. There is a feedback timeline which needs to be triggered when ALL the correct buttons are pressed. I have tried a seperate timeline 'counter' that advances on button click but if the user clicks more than once on the same button it advances the 'counter' Is there any easy solution?
Thanks, Michael
multiple correct case studies.zip (28.5 KB)

Hi Michael.

The way I've done it before is to add a hidden transparent rectangle over the button that can only be selected once and then change its state to visible when its selection triggers the counter timeline. That masks the button from being selected again.

Hope it is helpful.

1 Like

ah that makes sense - so once its clicked its blocked -thank you

A simple method to protect a button from being clicked multiple times: Assign an HTML attribute to the button, for example, 'data-clicked = 0'. When clicked, a script is executed that only starts the timeline if data-clicked is equal to '0'. After starting the timeline, data-clicked is set to 1. On the second click, the timeline will no longer start.

	if (element.dataset.clicked == 0) {
	
		element.dataset.clicked = 1;
		hypeDocument.startTimelineNamed('redSquare', hypeDocument.kDirectionForward);
	
	}

Bildschirmfoto 2024-08-16 um 08.04.39

protectButton.hype.zip (15.2 KB)

2 Likes

Thank you, very clever

You can use js “pointerevents” as well. I use it a lot.

3 Likes