A few things:
- No need to use
window.parent
unless your Hype document is inside an iframe. - If you use
HYPE.documents["name_of_your_doc"].functions().nameOfInternalFunction();
what do you get in the console? There shouldn’t be a problem calling an internal function this way.
Also, I’m not clear on the reasoning for having external functions call an internal function in Hype as this seems redundant. Am i missing something?
Just an FYI and it may help in your case. If you structure your external javascript file like so:
function myLibrary(hypeDocument, element, event) {
function myFunction(){
//do something
}
function myOtherFunction(){
//do something then
hypeDocument.startTimelineNamed("timeline", hypeDocument.kDirectionForward)
}
///// END /////
return true;
}
if("HYPE_eventListeners" in window === false) {
window.HYPE_eventListeners = Array();
}
window.HYPE_eventListeners.push({"type":"HypeDocumentLoad", "callback":myLibrary});
you will be able to call specific Hype API methods within your external script plus also run internal functions (if you need to) by using hypeDocument.functions().myInternalFunction(hypeDocument, element, event);
Be careful though as your external functions may get muddled if they are commonly named and you are using other JS libraries within the browser window where the document lies.