Linking to a hype scene from another hype document


(Craig) #1

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?


(Craig) #2

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?


#3

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)


Best way to manage and preload multiple large scenes?
Starting with a different Scene
(Craig) #4

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)


#5

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


(Craig) #6

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.


How to embed existing Hype project to another Hype project?🤔
#7

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


(Craig) #8

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.


#9

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?


(Freelancer) #10

check this Phonegap: Linking between scenes and optimizing memory usage


(Craig) #11

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)


(Freelancer) #12

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


(Craig) #13

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!


(Craig) #15

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!


(Freelancer) #16

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


(Craig) #17

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.


(Freelancer) #18

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.


(Steve Warby) #19

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


#20

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.


(Steve Warby) #21

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