FrameDelay
Kind of class: | class |
---|---|
Inherits from: | CoreObject |
Implements: | |
Version: | 03/21/08 |
Author: | Aaron Clinger |
Classpath: | org.casalib.time.FrameDelay |
File last modified: | Monday, 01 December 2008, 13:34:40 |
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
- FrameDelay (scope:Object, methodName:String, frames:Number, param:Object)
- Defines FrameDelay object.
Instance methods
- start : Void
- Starts or restarts the frame delay.
- stop : Void
- Stops the frame delay from completing.
- destroy : Void
- Removes any internal variables, intervals, enter frames, internal MovieClips and event observers to allow the object to be garbage collected.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
# Always call
onEnterFrame
before deleting last object pointer.Overrides:
Specified by:
start
function start (
) : Void
Starts or restarts the frame delay.
Specified by:
stop
function stop (
) : Void
Stops the frame delay from completing.
Specified by: