HTML5 Swiffy动画完成时的JavaScript侦听器?
有没有办法向Swiffy添加JavaScript侦听器,以便检测动画何时完成?(在SWF转换为Swiffy之前不编辑FLA) 在AS3中,我使用了加载SWF。JS中是否有类似的内容:HTML5 Swiffy动画完成时的JavaScript侦听器?,javascript,flash,listener,dom-events,google-swiffy,Javascript,Flash,Listener,Dom Events,Google Swiffy,有没有办法向Swiffy添加JavaScript侦听器,以便检测动画何时完成?(在SWF转换为Swiffy之前不编辑FLA) 在AS3中,我使用了加载SWF。JS中是否有类似的内容: private function loadAnimationCompleteListener():void { //add listener for when animation is complete animation.addEventListener(Event.ENTER_FRAME, i
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);
}
}
只需将警报
替换为js中您想要的任何内容