Is there any way to detect when a Swiffy animation has completed?

后端 未结 3 1373
囚心锁ツ
囚心锁ツ 2021-02-10 00:57

Do Swiffy animations trigger an event when they\'re complete? Or is there perhaps a way to grab the current frame vs. total frames?

I tried de-minifying runtime.js as men

3条回答
  •  梦如初夏
    2021-02-10 01:19

    Flash timeline frame script:

       import flash.net.navigateToURL;
       import flash.net.URLRequest;
    
       navigateToURL(new URLRequest("javascript:document.dispatchEvent(new CustomEvent('animation_done', {detail:{name:'sparkle'}}))"), "_self");
       stop();
    

    Javascript:

     document.addEventListener("animation_done", animationDone, false);
    
     function animationDone(e /* Event */){
         console.log('animation done ' + e.detail.name);
     }
    

提交回复
热议问题