Using Keyboard right and left buttons

Hi, I’m a noobie here - I cannot seem to find a way to use keyboard events (other than any key down / up) - is there a way to use the right and left arrow keys to change scenes?

Javascript possibly?

John

Hi John,

You can get the key code from the event object e by using JavaScript: e.domEvent.keyCode
Below is the entire script to change scenes when pressing the left / right arrow key (you can add it to the Key Down event of the document):

function onKeyDown(doc, e) {
  var keyCode = e.domEvent.keyCode;
  if (keyCode == 39) {  // right arrow
    doc.showNextScene();
  } else if (keyCode == 37) { // left arrow
    doc.showPreviousScene();
  }
}

Regards

Hi Toan Le,

thank you for your very prompt reply. Thanks for this information I will give it a try later today - I am very excited about Saola and see some great possibilities for it. I look forward to the next version and what it may bring along for us :smiley:

regards

John