Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Only accepting specific keys to end video

Hi all,

I'm looking to have a video end when one of two keys is pressed, but not any other, and then I want different things to happen depending on which key was pressed. Is there a way to do this? At the moment I can only see "keypress" as a video ending option, without any parameter to specify which keys would be allowed. If this is possible, what code would tell me which key was pressed (so that I can then specify different results in an inline script)?




  • Hi Mark,

    There are two questions in there.

    First, can you ignore all keys except for some? This is possible, but it will require some coding to handle the key presses yourself. So if it's not crucial, doing this may be more trouble then it's worth.

    Second, can you register which key has been pressed (and thus use this to control what happens next)? Yes, that's actually quite easy. There's an event variable, which is a tuple that contains the kind of event ('key' if a key was pressed) as the first element, and the actual response as the second element. So you could assign the key that was pressed to end the video to the variable movie_response as follows:

    var.movie_response = event[1]



  • Thanks very much - it's working perfectly!


Sign In or Register to comment.