Last time I looked, #1 wrapped your getter setters in another pair of function which is somewhat wasteful. That's why you'll never see pattern #1 in the framework code.
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Doug McCune Sent: Friday, June 27, 2008 1:21 PM To: [email protected] Subject: Re: [flexcoders] Re: Best Practice Data Binding If you define a getter and a setter you can add the [Bindable] metadata to either the getter or setter, it does the same thing either way. The only time you have to use a custom event to trigger the binding is when you have read-only properties (a getter but no setter). Doug On Fri, Jun 27, 2008 at 12:08 PM, securenetfreedom <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Any thoughts? In an DataModel class what is the best way to bind data. 1) Make the Setter Bindable, or 2) Make the Getter Bindable and dispatch an event on the Setter? What are the advantages and disadvantages of each? // Binding #1 [Bindable] public function set foo(val:String):void{ _foo = val; } public function get foo():String{ return _foo; } // Binding #2 [Bindable(event="fooChanged")] public function get foo():String{ return _foo; } public function set foo(val:String):void{ _foo = val; dispatchEvent(new Event(MyDataModel.FOO_CHANGED)); }

