Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save themorgantown/4570113 to your computer and use it in GitHub Desktop.
Save themorgantown/4570113 to your computer and use it in GitHub Desktop.
<script type="text/javascript" src="AppleClasses/AppleWidget.js"> </script>
<script>
function myCallback(hypeDocument, element, event) {
function widgetIsReady() {
widget.notifyContentIsReady();
}
// wait a second, then run widgetIsReady above
setTimeout(widgetIsReady,1);
}
// run 'myCallback once the Hype document has loaded (above)
if("HYPE_eventListeners" in window === false) {
window.HYPE_eventListeners = Array();
}
window.HYPE_eventListeners.push({"type":"HypeDocumentLoad", "callback":myCallback});
</script>
@micklavin
Copy link

Hi Morgan,

I have been trying to solve the White Flash issue in an iBook I am creating. I have created a Video and Audio widget with Hype (2.5) and placed it in iBooks. Each of my Widgets are about 1MB in size. I searched the Hype site and Apple's site but couldn't find a quick resolution. I did however, stumble upon this answer and pulled my hair out until I realised the setTimeout was only waiting 1 millisecond. Changing this up to 500 milliseconds (not ideal) appears to work for me.

// wait a second, then run widgetIsReady above
setTimeout(widgetIsReady, 500);

As I am not a programmer (my programming days were 20 years ago) - but more of a code tinkerer, I was surprised to find a solution. It may not be the best solution but I wanted to share it as I found the thoughts of using iAd Producer a little daunting.

Thanks,
Mick

@themorgantown
Copy link
Author

@micklavin -- Do you still see the white flash? There have been a few upgrades to iBooks author in the time it's taken for me to figure out how to get notified of comments on my Gists. BTW the latest for iBooks is kept updated here: http://forums.tumult.com/t/intro-to-exporting-ibooks-widgets/948

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment