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?
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.
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!
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.
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
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?
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"