Linking to a specific scene from inside and outside of a Tumult Hype document

Hi,

This works great and have been using this for a while, is it also possible to add another parameter to the URL, basically I am try to set a global variable within this script?

i.e. www.mysite.com/#privacy?en
or www.mysite.com/#privacy&en

where ? would be used for another script, this could be anything in reality.

Regards

Thanks Hans,

I think I understand how this works, hash[0] is the value after the #, subsequently hash[1] is the first value after the ?

so for a global variable I have added this as:
window.lang = hash[1];

Okay, How do I do this for right click?

Can we keep this in one thread @UXDJB?

1 Like

Hi this is my first post, i have a problem linking to timeline from outside of a Tumult Hype document, somebody could help me, how do it. Thanks!

1 Like

it’s well documented here :):
http://tumult.com/hype/documentation/3.0/#invoking-api-from-outside-oftumult-hype

3 Likes

Hi, Hans. Thanks so much!

thanks so much Hans

Hi. I feel a bit stupid, but I don’t se any On Scene Load in my Scene Inspector?
(Only On Layout Load, but that is autre chose, n’est pas?)
I need to let some, but not all, visitors come directly to a specific scene (out of six scenes) from an external link in an ad.
Even more stupid, I don’t know much JavaScript…
(Hype 4 Pro)
Someone? Thanks!
Anders

If you have more than one layout (a new document only has a single scene, which in a way is just a single layout), then you would see 'On Layout Load' instead of 'On Scene Load'.

You can download the 'sceneurls.hype' document linked in the first post to see how this works in a simple example. This runs JavaScript when the scene loads and supports the #sceneURL method. For your document, you would just need to have the JavaScript code from that document initiate 'On Layout Load' for your layouts where you want to support this method.

Thanks! I will try that. Mañana :slight_smile: It is late in Sweden.
Many thanks! Anders

1 Like

It worked! Don’t really know how but it did.
I found that the script must be on the default scene to work, this is important.
I don’t know if it also must be on the pages I wanted to find, but that is where I first put it.
What really made it work was to put it on the default scene.
Thanks a million!

(This was for a client who wanted visitors from abroad to see the scene direct:
https://advokatbostedt.se/#Engelska )

1 Like

Hello @Daniel,

I tried to understand if what you shared in this post could be useful for what I need to do, but I haven't solved it yet.

I have two Hype documents:

  • "parent" document, which has a general menu on page 2.

  • "child" document, which has its own sub-menu.

In the sub-menu of the "child" document there is a "return" button that must return to page 2 of the "parent" document, where the general menu is.

Can I achieve this by assigning a function to the "return" button of the "child" document?

I don't know how to write it, could you help me?

Thank you in advance for your attention and help!

in fact your setup can be everything along with the description. A livelink and/or hypedocuments (<- reduced to show the issue nothing more) can help a lot here.

Anyway: I'd think this is your way to go https://github.com/worldoptimizer/HypeGlobalBehavior
it's a nonscripting-solution provided by @MaxZieb, but you've got to get your head around :slight_smile:

Hello @h_classen,

Thank you for the suggestion.

What do you mean?

In fact, I seemed to understand that @MaxZieb's example explains how to create a network for widgets on the same page, and therefore in the same document.

I therefore do not know how to apply these indications to my case :confused:

If you mean that your parent and child are in any way different documents it does apply. You can always directly address a separate Hype document through the global variable HYPE.documents["your-document-ID"] and trigger some function as HYPE.documents["your-document-ID"].functions().yourFunction(). That approach of communication can get pretty involved and needs a bit of coding to sync actions between documents but works as demonstrated above. It fails to reach other documents if nested in iFrames, though.

What @h_classen was suggesting is to use the the built in method of Custom Behavior to communicate but it only works in the same Hype document. Global behavior is the attempt to forward these call across the entire window scope to all Hype documents living there and broaden that approach beyond the local document making document ID management obsolete.

In either case, if you are talking about separate documents you won’t see them interacting in the regular preview as only one document is rendered there. You would need to export and join the two generated script code chunks in one manually maintained HTML file. What is your setup exactly? Or are you somehow working with iFrames?

Hello @MaxZieb,

that's exactly what I'm doing: I export each of the two documents (parent document and child document), then put the .html and resource folders in the same "presentation folder" :+1: