Hello again. I’m trying out the key bindings that I posted about yesterday and found a solution by using the keybindings on a scene that only loads the first time the page loads. For some reason the keybindings where doubling the value and adding 1 after each click.
If it started at 1 click the next click would be used 3 times, then 7 times etc… this made the page load really slow and after a while of using it I got javascript crash.
Anyway, I’m trying to get the currentSceneName id and if the id = main it should prevent the click from happening.
Any idea on how to turn this code to what I am looking for?
$(document).on('keydown', function (e){
console.log(e.keyCode);
if (e.keyCode == 40) { //down arrow
hypeDocument.showSceneNamed('main');
}
});
The problem is that it will still trigger the scenes even if you’re on it.
Look at this and you will see what I mean, this is why I need it to be disabled if you are on the main scene, in this case scene “1”.
create a new function and load “onLoadScene”.
then let the action-line empty.
document.onkeydown = checkKey;
function checkKey(e) {
e = e || window.event;
if (e.keyCode == '39') {
// right arrow
//no action
}
else if (e.keyCode == '37') {
// left arrow
//no action
}
}
Thank you @MarkHunte & @strmiska for taking your time! I did what @strmiska told me to do and it worked. It might not be the best thing to do since you have a javascript on all the scenes but it works as intended. Thanks!