Home > FLEX > AS3 Signals – Threat to Event Dispatcher

AS3 Signals – Threat to Event Dispatcher

Hi all! Most of you would have predicted now what i gonna discuss here by reading title of this post. Yup I gonna speak about the AS3 signals developed by flex geek Rob Penner which is doing rounds in flash community quite some time.  Though this post meant for As3 signals, i gonna discuss about the pitfalls of Event Dispatching system. (Forgive people i could not explain the pitfalls as Rob penner mentioned but I try to list out some which i felt bad in my development experience).

Pitfalls of flash Event Dispatching system

  • We had situation to create custom event for just sending a values along with the event we dispatch. It might not sound really bad but to make it happen we should extend any subclass of IEventDispatcher class, override clone method, need to receive additional properties via constructor and   assign to public variable so that listener functions could access it. It has not ended here. Eg. If you would like to pass additional properties along with mouse event, you have to create one and create another custom event for  another event type atlast we will end up with lot of boiler plate code.
  • Event could be listened only by the ancestors of the component which is dispatching event. But most of the cases we need to listen an event in many components  which are not ancestors of dispatching component and obviously we would listen an event in system manager or stage as we could listen any event triggered in the app from anywhere. But the real gotcha is when we remove an event listener in one place and all other listener will be removed.
  • We dont have utility function which would listen an event only at once instead of that we should manually remove an event listener once it has been fired as well as we dont have event methods which would remove all the listeners for a  particular event type.
Categories: FLEX
  1. April 20, 2010 at 1:52 am

    Hi Mahesh,

    Thanks for the post; glad you like AS3 Signals. Have you tried Robotlegs? It works quite well with Signals.

    Robert

    • Mahesh
      April 25, 2010 at 11:48 am

      Sir, I heard about it but have not used yet and i hope, would use it in near future as it has been setting a new benchmark in flash application development. Hats-off to you !!!

  2. April 20, 2010 at 1:53 am

    There are many examples of how to use AS3 Signals on the wiki here:

    http://wiki.github.com/robertpenner/as3-signals/community-examples

  3. viaria
    December 20, 2010 at 3:55 pm

    Robert Penner, Respect.

  4. viaria
    December 20, 2010 at 3:56 pm

    export Robert.Penner.Respect;

  1. No trackbacks yet.

Leave a comment