FramePulse

Kind of class:class
Inherits from:Dispatcher
Author:Martijn de Visser
Classpath:org.asapframework.util.framepulse.FramePulse
File last modified:Thursday, 12 October 2006, 11:19:40
Class to simulate onEnterFrame events.
Usage:
  • var fpulse:FramePulse = FramePulse.getInstance();
    fpulse.addEventListener(FramePulseEvent.ON_ENTERFRAME, this);
    
    // next, define a function named "onEnterFrame" in your class...
    
    public function onEnterFrame (e:FramePulseEvent) : Void {
    
        // code goes here...
    }
    To stop code that is run in the class' onEnterFrame, remove the listener:
    fpulse.removeEventListener(FramePulseEvent.ON_ENTERFRAME, this);

    An alternate way to listen to enterframe events is as follows:
    var listener:Function = EventDelegate.create(this, onEnterFrame);
    FramePulse.addEnterFrameListener(listener);
    To stop listening to enterFrame events do this:
    FramePulse.removeEnterFrameListener(listener);
Implementation note:
  • Creates an empty clip named "__FramePulseClip" (by default on _level0, at depth 9888).
Events broadcasted to listeners:
  • FramePulseEvent with type: ON_ENTERFRAME At "onEnterFrame" event of created clip
    • (null)

Summary


Constructor
Class properties
Instance properties
Class methods
Instance methods
  • pulse : Void
    • This method is called by FramePulse's movieclip instance on its onEnterFrame method.

Constructor

FramePulse

private function FramePulse (
)

Class properties

CLIP_DEPTH

static CLIP_DEPTH:Number = 9888
(read)

Default stack depth of the FramePulse movieclip.

CLIP_NAME

static CLIP_NAME:String = "__FramePulseClip"
(read)

Default name of the FramePulse movieclip.

CLIP_ROOT

static CLIP_ROOT:MovieClip = _level0
(read)

Default root clip where the FramePulse movieclip is attached to.

sInstance

static private sInstance:FramePulse = null
(read)

Class methods

addEnterFrameListener

static function addEnterFrameListener (
inListener:Function) : Void

Add a listener to the FramePulse
Parameters:
inListener:
function to be called on enterframe, with parameter FramePulseEvent

getInstance

static function getInstance (

Returns reference to singleton instance of FramePulse.

removeEnterFrameListener

static function removeEnterFrameListener (
inListener:Function) : Void

Remove a listener from the FramePulse
Parameters:
inListener:
function that was previously added

Instance methods

pulse

function pulse (
) : Void

This method is called by FramePulse's movieclip instance on its onEnterFrame method.
Events broadcasted to listeners:
  • FramePulseEvent with type: ON_ENTERFRAME At "onEnterFrame" event of created clip
    • (null)