Gosh, I forgot all about this code..
@Jonathan is correct. The code at the time was specific in the file name it was going to find.
Do as he suggests and also one other change I recommend .
In stead of using classes use the buttons Additional Html Attributes to set a scene value to look for.
Doing this IMHO will make the code/project more versatile since adding Hype class names and then getting them will need to be hard coded again if you want to add a new class name to the list.
So Give each button a n Additional attribute key/name of
scenelink
And then the relevant value i.e scene2 for button two and so on.
And change:
localStorage.setItem('theScene', element.classList[1]);
if ( window.self !== window.top ){
hypeDocument.showSceneNamed( 'intro', hypeDocument.kSceneTransitionInstant, 1.1)
}
//var htmlWidget = hypeDocument.getElementById("render").children[0]; //iframe Widget
var htmlWidget = hypeDocument.getElementById("render").getElementsByTagName("iframe")[0] ; //iframe Widget
var hypeDoc = hypeDocument.documentId().split("_hype_container"); //document name
htmlWidget.setAttribute("src", hypeDoc[0] + ".html");
to
localStorage.setItem('theScene', element.getAttribute("scenelink"));
var htmlWidget = hypeDocument.getElementById("render").getElementsByTagName("iframe")[0] ; //iframe Widget
htmlWidget.setAttribute("src", location.href );
which will look for the additional attributes + the href which will load into the iframe.
The other thing to note:
When you use preview from Hype it will use its local Server to publish the page.
When you export to file, you cannot just double click and open the file in a browser locally and expect it to work because you will be loading a file:// in the browser from a locally store file and hit cross origin restrictions because you will not be publishing from a server which would use https:// of http://
You will need to disable the restrictions in the browser ( Safari Developer Menu > disable Cross Origin Restrictions ) and reload the page.
Make sure you turn the restriction back on when done.
There should be no problem if you upload to a server and then access it.
LoadSceneInFrame__v3.hype.zip (37.8 KB)