Trigger for Key Presses

Jan 25, 2013

Hi

I know there is a trigger that can be fired when a uses presses a particular key, or combination of keys, but I was wondering can you set a trigger to exclude a particular key press, for example

Change state of an object when the user presses any key but Y

If anyone has any ideas I'd be interested to hear them (even if it does include javascript )

H

6 Replies
Shwetha Bhaskar

Kinda clunky but one way to do it is set up triggers for each key except the one you want to exclude - Change state of object to new state when user presses Q, Change state of object to new state when user presses W, Change state of object to new state when user presses E etc. You'd have to copy paste triggers for each key on the keyboard :-/

If your context is a bit more complex, you could use a Boolean variable (adjust variable to true if an [allowed] key is pressed, adjust to false if [disallowed] key is pressed, and then change state if variable is true)...

Alan Shapiro

I know this is an older discussion but it was never answered. I am looking for something similar. I have a hotspot where the user needs to click on the delete key. This is working as expected. I want a try again layer to show if they press any other key. I am not sure how this can be done without creating a trigger for every single key on the keyboard. I really was hoping for an easier solution. I have tried using a boolean variable but again not sure how to change the variable to show the try again layer.

Ashley Terwilliger-Pollard

Hi Alan,

Have you seen the information here in terms of using the hotspot question? How many attempts have you set? If you've only set it for one they likely only see the "incorrect" layer and if you're using more than one attempt or have enabled other "false" hotspots - you could include it to show them the try again layer based on what they clicked. 

Alan Shapiro

I am familiar with how to create a hotspot question but not sure how this helps. I am not looking where the user is clicking but when they press a key. They need to press the delete key. I want the incorrect layer to show up if they press any other key besides the delete key. I thought a hotspot will only happen if the user clicks outside the hotspot.

This discussion is closed. You can start a new discussion or contact Articulate Support.