Hey guys, I have an iframe containing a hype document within my resources folder.
<iframe class="content" src="${resourcesFolderName}/index.html" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
I found this script listening to every klick made in this iframe:
<script>
$(document).ready(function(){
$("iframe").load(function(){
$(this).contents().on("mousedown, mouseup, click", function(){
alert("Clicked");
});
});
});
</script>
All working perfectly so far. I would now like to execute a function called resetTimer in my library, looking like:
function resetTimer() {
window.tenmins = 10000;
clearTimeout(window.timer_10_mins);
window.timer_10_mins = setTimeout(function () {
hypeDocument.showSceneNamed('screensaver', hypeDocument.kSceneTransitionInstant);
}, tenmins)
alert('done');
}
I found this code in Calling a function in Hype from an iframe
I added what jonathan's suggestion to my code, now looking like:
$(document).ready(function(){
$("iframe").load(function(){
$(this).contents().on("mousedown, mouseup, click", function(){
alert("Clicked");
window.parent.HYPE.documents["index"].functions().resetTimer();
});
});
});
In preview mode, the function executes, I see the "clicked"-alert, the "done"-alert, but it does not reset my timer to 10 mins. When I export it, it does not execute at all, though i have inserted the document name for "index", which by the way, does also not work for the solution in Calling a function in Hype from an iframe
Any ideas, what is wrong in here?
EDIT: I created a minimal version of my file and attached it to this postminimal_example.hype.zip (158.2 KB)