Noob JS 'change scene' problem

(Bill T) #1

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


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.

(Bill T) #3

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


(Bill T) #4

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


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


(Bill T) #6

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