Custom Events + Robotlegs + dispatch + Overriding the clone() method

Let me preface this by saying, this approach is certainly not the final say. Any tutorials, demos or information shared on my site should be taken for what they are worth. I love feedback, so feel free to leave a comment below.

[Update: As Amy mentioned in the comments, this is not specific to the Robotlegs framework.]

I have recently been tinkering with the new Robotlegs framework and wanted to share a quick gotcha. It’s really not a gotcha, and really more something I forgot to do. Click here to see the post that helped jog my memory on this one. Hope this will come in handy for someone.

View Demo | View Source

If you can’t read the white print on the demo it says:

This demo serves to explain the need for overriding the clone() method on custom events.

Notice that no output is generated when a user clicks the CustomEventOne button.

When a user clicks CustomEventTwo, the output is generated. This is because the MainMediator must re-dispatch the custom event, and so the developer must remember to Override the clone() method.

Right-Click to View Source, then look in the com.diomampo.rlcustomeventdemo.events package at the differences between both events.
You can leave a response, or trackback from your own site.

2 Responses to “Custom Events + Robotlegs + dispatch + Overriding the clone() method”

  1. Amy says:

    Hey, Steven;

    This problem is not unique to RobotLegs. You might find this post where I ran into the same issue trying to “reuse” an event http://www.insideria.com/2009/12/can-event-performance-be-impro.html

    Best;

    Amy

  2. admin says:

    Amy,

    Thank you, I have been meaning to update this post as more of a Best Practice. Ironically enough, I’ve been working with FlexPMD and it will even warn you if you don’t override the clone() method on any custom events. Great article by the way, hope to see you at 360|Flex in a month.

Leave a Reply

Subscribe to RSS Feed Follow me on Twitter!