Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 3. Building an Enterprise Framew... > Minimizing the Number of Custom Even...

3.5. Minimizing the Number of Custom Events

Until now, you’ve concentrated on building rich components for a business framework. We Flex architects also recommend some coding techniques that serve the same goal as these components: enabling application developers to write less code. In this section, you’ll see how to minimize the number of custom event classes in any application.

Flex is all about event-driven development. Create loosely coupled custom components and let them send events to each other, as in the mediator pattern example from Chapter 2. You can create new events for every occasion. If an event does not need to carry any additional data, just give it a name, specify its type as flash.events.Event, and define the meta tag to help Flash Builder list this event in its type-ahead prompts and dispatch it when appropriate. If your new event needs to carry some data, create an ActionScript class extending flash.events.Event, define a variable in this subclass to store application data, and override the method clone().


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial