FrameDelay

Kind of class:class
Inherits from:none
Classpath:org.asapframework.util.FrameDelay
File last modified:Sunday, 05 November 2006, 10:14:40
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
  • FrameDelay (inSender:Object, inCallback:Function, inFrameCount:Number, inParams:Array)
    • Constructor; starts the waiting immediately.
Instance properties
Instance methods
  • 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
  • wait (inSender:Object, inCallback:Function, inFrameCount:Number, inParams:Array) : Void
    • Stores input parameters (see constructor parameters), start waiting.
Event handlers

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 properties

mCallback

private mCallback:Function
(read)

mCurrentFrame

private mCurrentFrame:Number
(read)

mFramePulseListener

private mFramePulseListener:Function
(read)

mIsDone

private mIsDone:Boolean = false
(read)

mParams

private mParams:Array
(read)

mSender

private mSender:Object
(read)

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

wait

private function wait (
inSender:Object, inCallback:Function, inFrameCount:Number, inParams:Array) : Void

Stores input parameters (see constructor parameters), start waiting.

Event handlers

onEnterFrame

private function onEnterFrame (
) : Void

Handle the onEnterFrame event.
Checks if still waiting - when true: calls callback function.