Why not just use mx.events.EventDispatcher? All you have to do is set up
"dummy function" named addEventListener, dispatchEvent,
removeEventListener, and then use EventDispatcher.initialize(this) in
the constructor.
Or, if using AS3.0, I think you can wrap a flash.events.EventDispatcher
object (Decorator Design Pattern):
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;
class MyClass extends MovieClip implements IEventDispatcher {
//...
public function MyClass() {
//...
_dispatcher = new EventDispatcher(this);
}
public function addEventListener(type:String,
listener:Function):Void {
_dispatcher.addEventListener(type, listener);
}
public function dispatchEvent(event:Event):Void {
_dispatcher.dispatchEvent(type, listener);
}
public function hasEventListener(type:String):Boolean {
return _dispatcher.hasEventListener(type);
}
public function removeEventListener(type:String,
listener:Function):Void {
_dispatcher.removeEventListener (type, listener);
}
public function willTrigger(type:String):Boolean {
return _dispatcher.willTrigger(type);
}
private function _dispatcher:EventDispatcher;
}
(Note: I haven't actually tried AS3.0, so someone let me know if I
messed anything up.)
―
Mike Keesey
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Sean Scott
> Sent: Tuesday, September 26, 2006 12:09 PM
> To: [email protected]
> Subject: [Flashcoders] Delegating Events and AS2
>
> Hi All!,
>
> wondering if someone can point me in the right direction. I am trying
> to find a ASBoradcast / Event Dispatcher light model for my app.
>
> Basically i have a number of MCs that will have to either react to
> events being broadcast or broadcast their own.
>
> I have Essential AS2 by Colin Moock. Trying to find something i can
> import and maybe pass scope to it, vs have my main class extend it.
>
> I've googled, searched the archived and exausted my more talented
> flash developer friends.
>
> Thanks,
> Sean
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com