FrameDelay

Kind of class: public class
Package:
Inherits from:
  • none
Classpath: org.asaplibrary.util.FrameDelay
File last modified: Wednesday, 11 May 2011, 19:06:35
Delay a function call with one or more frames. Use this when initializing a SWF or a bunch of DisplayObjects, 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.
Usage
  • To execute function 'init' after 1 frame, use: new FrameDelay(init); To execute function 'init' after 10 frames, use: new FrameDelay(init, 10); To call function 'setProps' with parameters, executed after 1 frame: new FrameDelay(setProps, 1, [shape, 'alpha', 0]);
    private function setProps (inShape:Shape, inProperty:String, inValue:Number) : void {
    inShape[inProperty] == inValue);
    }
    

Summary

Constructor
  • FrameDelay (inCallback:Function, inFrameCount:int, inParams:Array = null)
    • Creates a new FrameDelay.
Instance methods
  • die () : void
    • Release reference to creating object.

Constructor

FrameDelay

function FrameDelay(inCallback:Function, inFrameCount:int, inParams:Array = null)

Creates a new FrameDelay. Starts the delay immediately.

Parameters
inCallback :the callback function to be called when done waiting
inFrameCount:the number of frames to wait; when left out, or set to 1 or 0, one frame is waited
inParams :list of parameters to pass to the callback function

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.