Home Button Go To First Scene


(Jud) #1

Can I use JavaScript to make the HOME key on a users keyboard take them to the first scene? If so, what code could I use? Thanks.


#2

Yup, that key code is 36. But keep in mind that not everyone has a ‘home’ button readily available on their keyboard.

This page is a quick way to get keycodes which lets you link keyboard actions to JS functions:

document.onkeydown = checkKey;

function checkKey(e) {
    e = e || window.event;
    if (e.keyCode == '36') {
        //home button
        hypeDocument.showSceneNamed('Scene 1', hypeDocument.kSceneTransitionCrossfade, 1.1)
    }
}

More info here:


(Jud) #3

Thanks Daniel! I also have a home button to click as an alternative.