Use page up/down to control time line

Is there any JS code can do start the next timeline once click arrow key or page up key? and start previous timeline once click arrow down or page down key?
down below code is not working when I want it to play next & previous timeline
document.onkeydown = checkKey;

function checkKey(e) {

e = e || window.event;

if (e.keyCode == ‘33’) {
// up arrow
hypeDocument.startTimelineNamed’all’,kDirectionForward )
}
else if (e.keyCode == ‘34’) {
// down arrow
hypeDocument.startTimelineNamed’all’,kDirectionReverse )
}
}

Thank you!

A couple things to note:

  • there is no notion of a next or previous timeline. Timelines can execute in parallel. If there is a specific ordering you’ll need to know what this is and keep track of which you are executing.

  • Your code has a syntax error, you need an opening parenthesis for the startTimelineNamed calls and kDirectionReverse is a constant in the hypeDocument object:

hypeDocument.startTimelineNamed('all', hypeDocument.kDirectionReverse);