AS2 EventDispatcher

by

I recently went back to some AS2 code and created a replica of the AS3 EventDispatcher in ActionScript 2.0. The code is based on Danny Patterson’s original EventBroadcaster code. I tried my best to match the syntax of the AS3 events package. I have made it available for you to use freely.

AS2 EventDispatcher

Note: I just wrote about this in my previous post about converting AS3 to AS2 but I wanted to repost it for easy search purposes.

Tagged ,
  • http://www.ekameleon.net/blog ekameleon

    Hello :)

    If you want test a full AS2 event model based W3C like AS3 you can test my event model in VEGAS AS2 :

    http://code.google.com/p/vegas/wiki/VegasTutorialsEvents

    you can download the source code in the SVN repository of the project :

    http://vegas.googlecode.com/svn/AS2/

    See the source code in the browser of Google Code :
    http://code.google.com/p/vegas/source/browse#svn/AS2/trunk/src/vegas/events

    You can find two implementation with vegas.events.EventDispatcher and vegas.events.FastDispatcher :)

    This implementation contains : priority, capturing, bubbling, event queue, global event flow with multicore factory and full W3C DOM2/3 implementation. See all examples.

    EKA+ :)

  • David Berne

    The’ Event’ class uses a reference to the interface ‘IEventDispatcher’ while the ‘IEventDispatcher’ contains a reference to ‘Event’ class. Why wouldn’t this result in a circular dependency then an error during compile?

    -DB

  • http://mimswright.com Mims H Wright

    @David

    Wow, you’re right! I don’t know why that would be allowed but it works. My only guess is that AS2 is not very strict about things like that whereas the AS3 compiler might throw an error.

    Good catch!

  • Andy

    I happen to need it. Thank you for sharing.