AS2 EventDispatcher

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.

About Mims H Wright

http://dispatchevent.org/wp-content/avatars/animemims.gif
This entry was posted in Flash, Programming and tagged , . Bookmark the permalink.

4 Responses to AS2 EventDispatcher

  1. ekameleon says:

    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+ :)

  2. David Berne says:

    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

  3. @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!

  4. Andy says:

    I happen to need it. Thank you for sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>