StageEventProxy

Kind of class:public class
Package:org.casalib.events
Inherits from:Destroyable
Implements:
Version:09/06/09
Author:Aaron Clinger
Classpath:org.casalib.events.StageEventProxy
File last modified:Sunday, 06 September 2009, 08:52:13
Created an event proxy between the Stage that implements IRemovableEventDispatcher and IDestroyable.
Usage note:
Example:
  • package {
        import flash.events.KeyboardEvent;
        import org.casalib.display.CasaMovieClip;
        import org.casalib.events.StageEventProxy;
        import org.casalib.util.StageReference;
    
    
        public class MyExample extends CasaMovieClip {
            protected var _stageEventProxy:StageEventProxy;
    
    
            public function MyExample() {
                super();
    
                StageReference.setStage(this.stage);
    
                this._stageEventProxy = new StageEventProxy();
                this._stageEventProxy.addEventListener(KeyboardEvent.KEY_DOWN, this._onKeyDown);
                this._stageEventProxy.addEventListener(KeyboardEvent.KEY_UP, this._onKeyUp);
            }
    
            protected function _onKeyDown(e:KeyboardEvent):void {
                trace("Key down " + e.keyCode);
    
                if (e.keyCode == 65) {
                    trace("a key pressed!");
    
                    this._stageEventProxy.removeEventListeners();
                }
            }
    
            protected function _onKeyUp(e:KeyboardEvent):void {
                trace("Key up " + e.keyCode);
            }
        }
    }

Summary


Constructor
  • StageEventProxy (stageId:String = StageReference.STAGE_DEFAULT)
    • Created a new StageEventProxy.
Instance properties
Instance properties inherited from Destroyable
Instance methods
Instance methods inherited from Destroyable

Constructor

StageEventProxy

public function StageEventProxy (
stageId:String = StageReference.STAGE_DEFAULT)

Created a new StageEventProxy.
Parameters:
stageId:
An identifier that corresponds to a stored Stage in StageReference.
Usage note:

Instance methods

addEventListener

public function addEventListener (
type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false) : void

See also:
  • "IEventDispatcher documention for this method."

destroy

override public function destroy (
) : void

dispatchEvent

public function dispatchEvent (
event:Event) : Boolean

See also:
  • "IEventDispatcher documention for this method."

hasEventListener

public function hasEventListener (
type:String) : Boolean

See also:
  • "IEventDispatcher documention for this method."

removeEventListener

public function removeEventListener (
type:String, listener:Function, useCapture:Boolean = false) : void

See also:
  • "IEventDispatcher documention for this method."

removeEventListeners

public function removeEventListeners (
) : void

Removes all event listeners.
#

removeEventsForListener

public function removeEventsForListener (
listener:Function) : void

Removes all events that report to the specified listener.
#
Parameters:
listener:
The listener function that processes the event.
#

removeEventsForType

public function removeEventsForType (
type:String) : void

Removes all events of a specific type.
#
Parameters:
type:
The type of event.
#

willTrigger

public function willTrigger (
type:String) : Boolean

See also:
  • "IEventDispatcher documention for this method."