I use google converted swiffy script like this
var stage = new swiffy.Stage(document.getElementById('swiffycontainer'),swiffyobject);
stage.start();
My point is I want to do the action after the animation end. but I don't know how to track the frame on swiffy object.
this is my work before asking
I put start method after page is loaded on
$(document).ready
$(window).load
window.onload =
and track the time (random test to reach the last frame) with
setTimeout(callAtEnd(),10000);
result: not work; like it count the time when page is rendering, not after complete rendered
result: not work either
Please help or give other solution to do.
Many thanks.
$(document).ready() will fire when the DOM is ready, but before the browser has finished loading all external resources.
window.onload will fire when the browser has finished loading all external resources. However, there may still be other operations being performed asynchronously.
Neither of these will give you a 100% accurate timing with relation to the swiffy timeline.
What you would need to do is add some ActionScript that will fire when the animation is complete. Since Swiffy only supports a subset of Actionscript, the simplest way is to have your Flash call a Javascript function by using the getURL() function, such as:
getURL("javascript:animationIsComplete();");
This way, Swiffy can call your completion handler directly without any need for timing page loads.
See Is there any way to detect when a Swiffy animation has completed?
You can call it in two ways:
document.onload=function() {}
window.onload = function() {}
The best to use is document.onload because it separates content structure from code, but it all depends on the amout of javascript you have.
If you want to use jQuery its:
$(document).ready() {}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With