How to call hype js function from external HTML


#1

Hi, I am trying to call MyFunction defined in Hype document. Please can you provide simple html that calls MyFunction?

I have tried:
hypeDocument.functions().MyFunction(hypeDocument, element, event);

but get:

Uncaught ReferenceError: hypeDocument is not defined(anonymous function)
@ 70e34:91f.Callbacks.n @ jquery.min.js:2f.Callbacks.o.fireWith @ jquery.min.js:2e.extend.ready @ jquery.min.js:2c.addEventListener.B @ jquery.min.js:2


Calling a function in Hype from an iframe
Start animation from external javascript function
hypeDocument is not defined or HYPE is not defined
#2

When running a function outside of the Hype document, you’ll need to include the document’s name (chosen when you export as HTML). If your document were named DocumentName, you would use this function:

HYPE.documents['DocumentName'].functions().MyFunction(HYPE.documents['DocumentName'],'foo',event);

(Edit: February 8, 2016 to fix the above function)


Same error despite using Daniel's recommended function syntax (call hype js function from external HTML)
Javascript API to load/unload hypeDocuments
#3

You had also asked how to restart an animation from outside of a Hype document. This function starts a scene instantly:

HYPE.documents['DocumentName'].showSceneNamed('MyScene',HYPE.documents['DocumentName'].kSceneTransitionInstant);


#4

Daniel, thank you very much! It works now…