There are a few "glitches" with what you propose: First, you cannot create a watcher that monitors all of your properties at once. The binding chain contains a hierachy list of parents and children. The chain is there so that any change on the parents or children will trigger the binding. Your proposed approach will definitely not work. Second, the only way to detect a change on a property is to create a setter/getter pair. And I personally don't think that creating setters/getters makes a class hard to read but this is just my own opinion. Finally, if you want to make a read-only property bindable, the class has to support the IEventDispatcher interface and your class doesn't seem to. Make sure it derives from EventDispatcher or that it at least implements the IEventDispatcher interface. If you're still convinced that using setter/getter is ugly, you may want to look into the Proxy or ObjectProxy class. They should enable you to do what you're looking for but you'll have to implement the IEventDispatcher interface for the Binding to work.
________________________________ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of steve horvath Sent: Friday, June 26, 2009 7:39 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Watching a class full of bindable properties I have a class marked Bindable with many properties. The class has a read-only function which returns come custom XML based on the properties. I want to fire a bindable event when any of the properties change. So far the ways that I've thought of doing it are: 1) Create a ChangeWatcher that monitors each individual property. (The host would be "this" and the chain would be an array with every single property listed in it.) 2) Write a setter and a getter for every single property, with the setter dispatching a custom bindable event. The problem with the first method is I'd have to list out every property. Every time a property was added to this class I'd have to make sure I updated the chain array. The problem with the second method is I'd have to write setters and getters for every single property. (The actual class has more than 20 properties.) It would make the class harder to read. Is there a way I could watch the properties for change with just a couple lines of code? [Bindable] public class TheProperties { public var presetName:String="default"; public var presetThumb:String=""; public var presentationTitle:String=""; public var presentationThumb:String=""; public var presentationLogoURL:String=""; // many more properties... [Bindable(event="propertyChangeEvent")] // necessary to get rid of binding warnings public function get xmlCode():XML { // some funky stuff to create XML based on above properties } }