FrameDelay

Kind of class:class
Inherits from:CoreObject
Implements:
Version:12/14/06
Author:Aaron Clinger
Classpath:org.casaframework.time.FrameDelay
File last modified:Wednesday, 07 March 2007, 14:18:41
Creates a callback after one or more frames have been fired. Helps prevent race conditions by allowing recently created MovieClips, Classed, etc... a frame to initialize before proceeding. Should only need a single frame because onEnterFrame should only occur when all frame jobs are finished.
Since:
Flash Player 7
Example:
class Example {
    public function Example() {
        // A lot of inits, attachMovies, etc...

        var initDelay:FrameDelay = new FrameDelay(this, "initComplete");
        initDelay.start();
    }

    public function initComplete():Void {
        // Safe to execute code
    }
}

When starting a SWF or after attaching a movie:
var initDelay:FrameDelay = new FrameDelay(this, "initComplete", 1, "Aaron", 1984);
this.initDelay.start();

function initComplete(firstName:String, birthYear:Number):Void {
    trace(firstName + " was born in " + birthYear);
}

Summary

Constructor
Instance properties
Instance properties inherited from CoreObject
Instance methods
Instance methods inherited from CoreObject

Constructor

FrameDelay

function FrameDelay (
scope:Object, methodName:String, frames:Number, param:Object)
Defines FrameDelay object.
Parameters:
scope :
An object that contains the method specified by "methodName".
methodName:
A method that exists in the scope of the object specified by "scope".
frames :
[optional] The number of frames to wait before calling "methodName". frames defaults to 1.
param(s) :
[optional] Parameters passed to the function specified by "methodName". Multiple parameters are allowed and should be separated by commas: param1,param2, ...,paramN

Instance methods

destroy

function destroy (
) : Void
Removes any internal variables, intervals, enter frames, internal MovieClips and event observers to allow the object to be garbage collected.

Always call destroy() before deleting last object pointer.
#

start

function start (
) : Void
Starts or restarts the frame delay.

stop

function stop (
) : Void
Stops the frame delay from completing.