Improved doLater method
20 12 2005Igor from play.ground has just blogged about his improved doLater method for postponing ActionScript calls. Its a very useful function similar to setTimeout in Flash 8, be it frame based rather than using a timed interval.
As soon as I have some time to spare I’ll make one that supports both frame and time based intervals, shouldn’t be too hard to do. Would also be nice to have the doLater interval be relative to a specific event but will have to give that some more thought.






Hi Peter,
I think that this doLater functionality exists in at least one open-source library. as2lib (www.as2lib.org) contains an impulse package (org.as2lib.env.event.impulse). There is an Impulse interface. Here is a snip from the docs for the Impulse interface:
Impulse is a definition for events that gets executed periodically.
Periodical events could be frame executions, seconds, hours or dates.
Impulse allows to seperate the certain kind of Impulse from the
execution code.
I haven’t actually tried it out, so I can’t tell you firsthand how well it works. I suppose you can see the email address I entered when posting this comment. It would be nice if you have a chance to try this package, if you could let me know what you think of it. Thanks!
Thanks for that David, I’ll certainly give that a try — I’ve briefly looked at as2lib in the past but didn’t realize that was in there, very cool!