Triggers based on keystrokes

Oct 17, 2019

I can't see that there is a good way to show a "wrong" layer based on keystrokes (the key the user presses), without making a trigger for every key on the keyboard. Even if you use variables, you still need to specify the key and there is no "User does NOT press key _____" functionality in the trigger wizard. 

I'm making an interactive where the user is supposed to select the right keystroke (sometimes an F key, sometimes a number key, sometimes Tab) to advance to the next slide. In a perfect world, I'd like a wrong layer to pop up if they select the wrong key.

The Text Entry object doesn't really work either because it requires you to hit enter every time and doesn't work with F keys. 

In JavaScript it would be a simple if/else statement.

I feel like I'm missing something.


2 Replies
Jerry Beaucaire

Javascript would likely be the short-term solution as well.   

  1. Create a text variable that is blank by default.
  2. Use some JS to listen for the next keystroke by the user.  If it matches the keycode you want, have JS update the variable to "Good".  If it doesn't match, update the SL variable to "Bad".
  3. A trigger in SL watching for that variable to change can then give the response/layer you want based on the value in the text variable.

(some sample code watching for the ENTER key - keycode13)

(a discussion on this topic with several useful approaches)

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