Linking to a hype scene from another hype document

I have a very large project that is using 5 Hype different sections. Section 1 links to all the other 4 hype sections. But I need to link to specific scenes within the other 4 scenes, from my main section. I hope that makes sense. Essentially, I need to link to a specific scene in a hype document from another hype document. An iFrame will not work. I want to go directly to that scene. How can I accomplish this?

just to note, I have read this page, but don’t understand it completely: Linking to a specific scene from inside and outside of a Tumult Hype document

Do I need to add the script to EVERY scene that is being suggested in that post? Or to just the one scene I need to link to?

Hi Craig (@craigah13)

All you need is to use this line as your link.

HYPE.documents['**Document Name**'].showSceneNamed('**Scene Name**'); 

You can place this in a “On Mouse Click” --> “Run Javascript…” function on any element.

Or you can create your own HTML link and place it there as:

<a href="#" onclick="HYPE.documents['Document2'].showSceneNamed('Scene 2');">Link</a>

This assumes you have named your document “Document2” and the scene within it is named “Scene 2”

Live Example

Document1.hype.zip (32.3 KB)
Document2.hype.zip (35.4 KB)

ok, I must be missing something. I’ve uploaded a zip file of what you had, but I’ve reorganized it to be similar to what I’m working with.

When you open Document1.html, I need one of the buttons/links to link to a scene/page within Document2.html.

testing.zip (258.4 KB)

The technique above assumes that you have both the <div> 's and <script>'s that are exported in the same HTML file. So, your structure would look like this:

• testing
    •index.html
    •Document1.hyperesources
    •Document2.hyperesources 

inside index.html you would have both of the exported code (div followed by script)

They would then be able communicate with each other

I’m defintely missing something when doing this. I can’t seem to get a button in my Document1.html to link to Document2.html. Not sure what I’m doing wrong. Seems like such a simple thing and it’s doing my head in.

you can’t do it between 2 .html files you have to include the code from both those files into 1 file.

you would think that if you can give a scene a direct url, and link to that specific scene url, that you would be able to link to it from another hype document. I’ve been able to give my document2.html scenes URLS “document.2.html#Scene 2” but can’t link to it.

maybe it’s time to share a document? Can you upload a copy here so we can look at it?

or point us to an external link?

check this Phonegap: Linking between scenes and optimizing memory usage

I can’t share my original files as the client is a major auto company. I have included test files zipped up as an example of how I have my files structured. In my original files, each hype doc has around 60 scenes, so cobbling them ALL together would mean over 240 scenes in one doc. Not ideal. Hence why I’ve had to break them out into 4 sections. Now I need to link to them, and some individual scenes from my “home page”, if that makes sense!?!TEST.zip (479.0 KB)

not sure but I think you can do it with the code in the post above. I created an app made with 4 projects

agreed. I am looking at it now and going to implement it into my project. Will follow up shortly. Thanks for the quick responses guys!

Seems to be working! Thanks @michelangelo and @DBear for all the help.

Funny though, that when I was doing this, my save and export seemed to be behind by 1. I entered a link, exported, and then tested, and the old link was still in there. Must be my machine telling me it needs a break. A bit like me, it’s overworked. Anyway, thank you again for the help guys!

Nice! this is also a safe way to avoid memory warning.

I hope to find a way to add also the timeline name of the linked scene.

like this: index.html?scene=SceneName?timeline=TimelineName

that would be a nice feature @michelangelo!

My next step on this project is to get a mute button to work across the whole site.

I'm not sure but you can't do this in hype with multiple projects.
Maybe a master project ( persistent audio symbol + iframe) could be the solution.

Hi Guys,

I must be doing something dumb here.

I have 2 projects in the same folder.
The second project is named toughsystem and the first scene is scene1
I am running this from the first project.

HYPE.documents[‘toughsystem’].showSceneNamed(‘scene1’);

I get the following error.

Error in untitledFunction2: TypeError: undefined is not an object (evaluating ‘HYPE.documents[‘toughsystem’].showSceneNamed’)

Cheers

Steve Warby

Are you running this after both documents have loaded? Is either contained within an iframe? The error is basically saying that the HYPE.documents object doesn’t yet exist.

I’m not getting this.

Do I have to manually edit something somewhere.

I have 2 separate projects.

I have exported both to the same folder.

Please expand on ‘after both documents have loaded’

I have downloaded the example above Document1 & Document2 and get the same error so I am missing something.

Cheers

Steve Warby