2

Есть ли способ добавить слушателя JavaScript в Swiffy, чтобы определить, когда анимация завершена? (без редактирования FLA до конвертации SWF в Swiffy)Воспроизведение JavaScript в случае завершения HTML5 Swiffy Animation?

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

ответ

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.