Skip to content

Instantly share code, notes, and snippets.

@RandomEtc
Created August 10, 2010 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RandomEtc/517743 to your computer and use it in GitHub Desktop.
Save RandomEtc/517743 to your computer and use it in GitHub Desktop.
implements IEventDispatcher, for when you can't subclass EventDispatcher directly
///// IN IMPORTS
import flash.events.IEventDispatcher;
import flash.events.EventDispatcher;
/////
///// IN CLASS DECLARATION:
implements IEventDispatcher
/////
///// IN CONSTRUCTOR:
this.dispatcher = new EventDispatcher(this);
/////
private var dispatcher:EventDispatcher;
public function willTrigger(type:String):Boolean
{
return dispatcher.willTrigger(type);
}
public function dispatchEvent(event:Event):Boolean
{
return dispatcher.dispatchEvent(event);
}
public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void
{
dispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference);
}
public function hasEventListener(type:String):Boolean
{
return dispatcher.hasEventListener(type);
}
public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void
{
dispatcher.removeEventListener(type, listener, useCapture);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment