Here’s my JS code that I set to run on scene load:
document.onkeydown = checkKey;
function checkKey(e) {
e = e || window.event;
if (e.keyCode == '13') {
hypeDocument.showSceneNamed('dashboard', hypeDocument.kSceneTransitionCrossfade, 0.2);
}
I’d like to run this code only if current scene is named 'hello'.
Any help appreciated.
Note that Scenes do have On Key Down handlers themselves in the Scene Inspector. So you could potentially setup a handler there. You would still need to look at the event.keyCode to filter the keystrokes yourself.