Execute An AS3 Function After Exactly One Frame – DelayedFunctionQueue

I asked this question on Stack Overflow:

What’s the best way to execute a function after exactly one frame?

Based on the feedback I wrote a little class to make it super easy to do. You add function references to a queue, and those functions get called (in the order they were added) on the next Flash Player Frame.

Herewith, the DelayedFunctionQueue.as

Unpack, and put it in the following folder in your source path: net/boyblack/robotlegs/utils (or edit the package declaration if you want to put it elsewhere).

Usage1: DelayedFunctionQueue.add( func );
Usage2: DelayedFunctionQueue.add( func, arg1, arg2, argn );

Posted in Code | Tagged , , , , | 1 Comment