【发布时间】:2021-02-08 19:30:30
【问题描述】:
Adobe Animate Canvas 生成内容,我将该内容附加到 iframe 中。然后画布并在 iframes 文档中创建各种脚本变量。
我需要访问adobe动画的iframe完全加载时生成的变量'stage'。
我现在必须做的 - 附加 setTimeout 然后它似乎可以访问。 如果我不附加超时,控制台会抛出错误。
我想要实现的 - 我想避免 setTimeout 并以更好的方式重构代码。
我试过jquery:
$element.on( 'load', function() {
// Gives error when accessing the stage property
$element[0].contentWindow.stage
// allows to access stage property
setTimeout(() => {
console.log($element[0].contentWindow.stage)
}, 1000)
});
【问题讨论】:
-
我不会抱怨投反对票,但至少您可以提供帖子缺少的信息。
-
您实际上必须在 iframe 中执行此操作,然后在加载时告诉父级我完成了,继续!
标签: javascript jquery iframe createjs adobe-animate