gpt4 book ai didi

HTML5 Swiffy 动画完成时的 JavaScript 监听器?

转载 作者:行者123 更新时间:2023-11-30 05:48:32 24 4
gpt4 key购买 nike

有没有办法向 Swiffy 添加 JavaScript 监听器,以便检测动画何时完成? (在 SWF 转换为 Swiffy 之前不编辑 FLA)

在 AS3 中,我使用了加载 SWF。 JS中有没有这样的东西:

private function loadAnimationCompleteListener():void { 
//add listener for when animation is complete
animation.addEventListener(Event.ENTER_FRAME, isAnimationComplete);
}

//tell me when the intro animation is complete
private function isAnimationComplete (e:Event):void {
if (e.target.currentFrame == e.target.totalFrames) {
//do something here
//remove listener
animation.removeEventListener(Event.ENTER_FRAME, isAnimationComplete);
}
}

最佳答案

试试这个:

private function loadAnimationCompleteListener():void { 
//add listener for when animation is complete
animation.addEventListener(Event.ENTER_FRAME, isAnimationComplete);
}

//tell me when the intro animation is complete
private function isAnimationComplete (e:Event):void {
if (e.target.currentFrame == e.target.totalFrames) {
//do something here
navigateToURL(new URLRequest("alert('animation complete.')"), "_self");
//remove listener
animation.removeEventListener(Event.ENTER_FRAME, isAnimationComplete);
}
}

只需将 alert 替换为您想要的 js 即可。

关于HTML5 Swiffy 动画完成时的 JavaScript 监听器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16286587/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com