Copy link to clipboard
Copied
Hello,
I am creating an e-learning course and using Adobe Animate for the content (html5 canvas). I have a html webpage (I will call the wrapper) which loads in the content via an iframe. There are times when I would like the animate content to communicate with this wrapper, for example, passing a quiz score result from the content to the wrapper.
Can anyone advise the best way to do this?
Hope this makes sense.
Many thanks.
This came up recently with OAM packages. It think the same might work for iframe. The 'window' variable usually points to the window that the regular HTML is running in. With OAM, and probably iframe, 'window' points to the module not the main window, so that the entity is self contained.
Which means you can talk to window.parent to get at the real window.
Copy link to clipboard
Copied
This came up recently with OAM packages. It think the same might work for iframe. The 'window' variable usually points to the window that the regular HTML is running in. With OAM, and probably iframe, 'window' points to the module not the main window, so that the entity is self contained.
Which means you can talk to window.parent to get at the real window.
Copy link to clipboard
Copied
Hi Colin,
Many thanks for your speedy response, please can I check if this is what you had in mind:
html wrapper: var mainScore;
Animate File: window.parent.mainScore = 10;
I seem to be getting the error message: Uncaught DOMException: Blocked a frame with origin "null" from accessing a cross-origin frame.
I'm not sure if this is the way to go?: Window.postMessage() - Web APIs | MDN
Copy link to clipboard
Copied
If the iframe is coming from another domain, yes, I would expect problems. Don't know the postMessage thing, but it sounds on the right lines.