2

有没有办法向 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);
      }
}
4

1 回答 1

1

尝试这个:

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);
    }
}

只需将alertjs 替换为您想要的任何内容。

于 2013-07-08T16:34:48.957 回答