Access keys

FrameDelay

Kind of class: class
Inherits from: none
Classpath: org.asapframework.util.FrameDelay
File last modified: Monday, 06 November 2006, 08:09:16
Class that provides one or more frames delay.

Use this when initializing a swf or a bunch of movieclips, to enable the player to do its thing.
Usually a single frame delay will do the job, since the next enterFrame will come when all other jobs are finished.
This class will catch that next onEnterFrame and fire the function in the object passed as parameters.

A parameter is available if the delay has to be more than one frame.
Usage:
class myClass {

private var mFrameDelay:FrameDelay;

    function init () : Void {
         ... do a bunch of inits

        // wait one enterFrame
        mFrameDelay = new FrameDelay(this, initDone);
    }

    private function initDone () : Void {
        ...
    }

    private function goAway () {
        mFrameDelay.die();
}

When starting a swf:
var lc:LocalController = new MyLocalController(this);
// wait one enterFrame before notifying the MovieManager that this movie is done initializing
var fd:FrameDelay = new FrameDelay(lc, lc.notifyMovieInitialized);

Summary

Constructor
Instance methods

Constructor

FrameDelay

function FrameDelay (
inSender:Object, inCallback:Function, inFrameCount:Number, inParams:Array)
Constructor; starts the waiting immediately.
Parameters:
inSender :
Object, the class that contains the function to be called when done waiting
inCallback :
Function, the callback function to be called when done waiting
inParams :
Array, list of paramters to pass to callback function
inFrameCount:
Number, the number of frames to wait; when left out, or set to 1 or 0, one frame is waited

Instance methods

die

function die (
) : Void
Release reference to creating object
Use this to remove a FrameDelay object that is still running when the creating object will be removed