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 17. Custom components > Get your components to communicate

17.6. Get your components to communicate

Rather than show you all of the different ways data can be passed within an application, we’ll instead primarily focus on methodologies that support loose coupling and are also consistent with the core design patterns and methodologies that the Flex framework is built on. More specifically, we’ll mostly look at how data binding and events can be used to get your components communicating with each other. This will lead you nicely into chapter 18, where I’ll show you some interesting design patterns for communication between objects that will make your life a lot easier by making your code reusable.

17.6.1. Use getters and setters as property proxies

The notion of using getters and setters to declare properties of a component is quite simple. Let’s say you’ve created a custom ActionScript control component that use a Tree in place of the default list for a ComboBox. In addition, every node in the tree must have a CheckBox associated with it. Before you move any further, you already know that you’ll need to access the Tree component and you’ll need a variable to hold the data collection for the component as well. Listing 17.11 demonstrates how you can accomplish this in a simple four-step process.


  

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