Executing time without timelines


/ Published in: ActionScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function time(func, delay) {
  2. clearInterval(waiter);
  3. waiter = setInterval(func, delay);
  4. }
  5.  
  6. // Sequence usage:
  7. // start();
  8. //
  9. // function start() {
  10. // trace("This is start 1");
  11. // time(finish, 2000);
  12. // }
  13. //
  14. // function finish() {
  15. // time();
  16. // trace("This is the end. The setInterval is cleared.");
  17. // }
  18.  
  19. // Simple go to next frame after time duration:
  20. // time(goNextFrame, 1000);
  21. // function goNextFrame() {
  22. // time();
  23. // _root.nextFrame();
  24. // }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.