Is there any way to detect when the Swiffy animation is complete?

Does Swiffy perform an animation of an event when it is completed? Or maybe there is a way to capture the current frame compared to general frames?

I tried to de-runtime.js as mentioned in another SO post, but I cannot decrypt it.

+5
source share
3 answers

For those who come across this post, I have found a solution. I ended up using the getURL () call at the end of my FLA. It looks like this:

getURL("javascript:animationIsComplete();");

Put everything you want in the animationIsComplete () function, and now it will run at the end of the Swiffy animation.

+6
source

Frame 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);
 }
+2
source

If someone else comes across this issue and works with ActionScript 3, the main answer will not work for them, since the getURL () function is available only in ActionScript 2 and earlier.

Use the following for ActionScript 3:

navigateToURL(new URLRequest("javascript:your_function()"), "_self");

Add this as an action to the final frame of your animation in Flash, and then convert it using Swiffy. You can then output from Swiffy and execute it on a web page. Just make sure you define your JavaScript function somewhere in the source of the page displaying the Swiffy animation.

0
source

All Articles