Javascript jump to scene


(Jeff) #1

Hi. I’ve got a .js file in Hype, being called from within an HTML Widget. At the end of that .js file, the script will automatically send the user to another scene. I’m stuck on how to format the location properly:

document.location.href = "index.html";

The above line with this code:
hypeDocument.showSceneNamed('sceneName', hypeDocument.kSceneTransitionCrossfade, 1.1)

Doable? Thanks in advance for your help.


(strmiska) #2

did you try:

window.location.href = "index.html";

or if you want to link to antoher iframe:

parent.location.href = "index.html";

maby you have to use postmessage. there´s a similar article:


(Jeff) #3

Thank you. I saw that thread, but it was a little unclear to me. Also, I may not have been totally clear in my explanation. This is a better description of what I’m trying to accomplish:

document.location.href = " [in here have code that takes me to a specific scene within the same hype document ] "

Thanks!


(strmiska) #4

in my opinion it would be the best to load the document first, then “onSceneLoad” set “gotoSceneXXX” automatically.
if you want to control from iframe the parent hype-doc i recommend postmessage.


(Hans-Gerd Claßen) #5