I do 2) all the time. Didn't know 1) was even an option.
On Fri, Jun 27, 2008 at 12:08 PM, securenetfreedom <[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)); > } > >