Skip to main content
100%

callNextFrame for as3

✓ Published0🌍 Public
RRandomEtc
Last edited Jul 7, 2009
Created on Jul 7, 2009

This code sample demonstrates a deferred-call pattern for ActionScript 3, showing how to queue functions and execute them on the next animation frame. It uses the `Event.ENTER_FRAME` event to schedule callbacks, adding a listener when the queue is first populated and removing it after the pending calls are flushed. The `callNextFrame` method stores each callback and optional arguments in an array, and the `onEnterForCallNextFrame` handler shifts through the queue, applying each function with `Function.apply`. The implementation relies on the `Event` class and `IEventDispatcher` methods `addEventListener` and `removeEventListener` to trigger the batch processing.

AI-generated description

Similar vizzes