Accessing Multiple animate cc canvas embedded using iframes
After spending countless hours searching and trying various methods, I'm out of ideas. I need to embed multiple canvases on a page, and trigger their timeline when they come into view from an external js file. For the sake of brevity, I'll leave that part out.
My iframe canvases render fine, however, I can't seem to be able to target a child movie clip timeline, and can't seem to wrap my head around where I'm going wrong.
I've declared this on my main timeline as suggested in another post
var _this = this;
window.sceneOne = this;Here is the code that is being iframed in:
<div id="animation_container" style="width:665px; height:344px">
<canvas id="canvas" width="665" height="344" style="position: absolute; display: block; background-color:rgba(255, 255, 255, 1.00);"></canvas>
<div id="dom_overlay_container" style="pointer-events:none; overflow:hidden; width:665px; height:344px; position: absolute; left: 0px; top: 0px; display: block;">
</div>
</div>
Here is the parent page (where the js file lives):
<div id="scene-1-canvas" class="responsive-canvas" style="margin: 30px 0;">
<iframe id="scene-1-iframe" src="/canvas/Scene-1/scene-1.html" scrolling="no"></iframe>
</div>
Here is the function that I want to call at a specific time:
function raiseSun() {
var iframe = document.getElementById("scene-1-iframe").contentWindow;
iframe.sceneOne.mainMovie.house.sun.gotoAndPlay(2);
}
raiseSun();sceneOne is the variable I declared to reference the main timeline. mainMovie is the instance name that lives on the main timeline. Then there is a movie clip within that (house), and then finally (sun) is within that.
Any guidance or suggestions would be greatly appreciated
