Noob JS 'change scene' problem

Really no idea how to get started with this. To test it out, I run a preview, and then I’m trying to enter:

hypeDocument.showSceneNamed('anim',hypeDocument.kSceneTransitionPushRightToLeft,1);

In the console, but I just get:

VM171:1 Uncaught ReferenceError: hypeDocument is not defined at <anonymous>:1:1

Back every time. Can you help me get started with this? Thanks! :blush:

Hi Bill!

An example Hype project that displays this problem will be useful for others to find a solution.

Hey Jim - just sussed it out! These are the calls I needed:

    HYPE.documents['comment04'].showSceneNamed('anim',HYPE.documents['comment04'].kSceneTransitionFade)
HYPE.documents['comment04'].showSceneNamed('static',HYPE.documents['comment04'].kSceneTransitionFade)
2 Likes

where comment04 is the name of the doc (seems you might need to export for this to work, not ‘preview’)

hypeDocument is not global so therefore unavailable hence why you get the "is not defined". The global variable is always "HYPE" and "HYPE.documents" is an array of all the documents that are on the page so by targeting the specific document

HYPE.documents["documentName"]

You can call any API function on that document.
P.S in preview the document is always named "index"

HYPE.documents["index"]
1 Like

That’s great, thanks for letting me know about the preview mode ‘index’.