Alternative to Application.application

by

If you are using Application.application in your code you aren’t probably doing the best thing to your code for reasons more than one. Like Flex 4 no longer supports it, While using sub-applications or modules it will end up in trouble and MOST IMPORTANTLY it will tightly couple your application to the component

Instead, for most cases you (if you are dispatching an even using Application.application) you can set the events bubble property to true and listen to the same events at the application level. This will work for itemRenderers in DataGrid’s too.

Other option is to use a GenericEventDispatcher that extends from EventDispatcher and can be a singleton. So instead of dispatching an event using Application.application.dispatchEvent you can instead use GenericEventDispatcher.instance.dispatchEvent. This will work across all components and also between modules and sub-applications.

Advertisements

Tags: , ,

One Response to “Alternative to Application.application”

  1. Flex Framework for SalesForce Apps- Part 2 The Framework « Says:

    […] to push data from a non UI class to use a GenericEventDispatcher which I described in an earlier post. You may want to use this or may not want to user […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: