【问题标题】:JavaScript Listener for when HTML5 Swiffy Animation is Complete?HTML5 Swiffy 动画完成时的 JavaScript 侦听器?
【发布时间】:2013-04-23 14:06:42
【问题描述】:

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

【问题讨论】:

    标签: javascript flash listener dom-events google-swiffy


    【解决方案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);
        }
    }
    

    只需将 alert 替换为您想要的 js 中的任何内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-24
      • 2016-06-09
      • 1970-01-01
      相关资源
      最近更新 更多