> As long as you define the [Bindable] metadata tag right before a > getter, the > order of the setters/getters doesn't really matter.
I remember Alex Harui saying Bindable can indeed go before the setter, too. See this page: http://livedocs.adobe.com/flex/3/html/databinding_8.html#194574 Note #3: "Before a public, protected, or private property defined by a getter or setter method" --- In [email protected], "Tibor" <ballai.t...@...> wrote: > > > > Hi Nick, > > As long as you define the [Bindable] metadata tag right before a getter, the > order of the setters/getters doesn't really matter. > > However, as a coding convention, most people do define getters before > setters, it helps by making your code more maintainable. > > Here are a few examples where the order does matter: > > /*~~~~~~THIS IS CORRECT~~~~~~~~~~~~~~*/ > > [Bindable("fooChanged")] > public function get foo():String{ > return _bar; > } > public function set foo(value:String):void{ > _bar=value; > this.dispatchEvent(new Event("fooChanged")); > } > private var _bar:String; > > ///////////////////////////////////////////////// > > > /*~~~~~~THIS IS STILL CORRECT even through the setter is defined > first~~~~~~~~~~~~~~~~~~~~~~~~*/ > > public function set foo(value:String):void{ > _bar=value; > this.dispatchEvent(new Event("fooChanged")); > } > [Bindable("fooChanged")] > public function get foo():String{ > return _bar; > } > private var _bar:String; > > ///////////////////////////////////////////////// > > > /*~~~~~~THIS IS INCORRECT~~~~~~~~~~~~~~~~~~~~~~~~*/ > > [Bindable("fooChanged")] > public function set foo(value:String):void{ > _bar=value; > this.dispatchEvent(new Event("fooChanged")); > } > public function get foo():String{ > return _bar; > } > private var _bar:String; > > ///////////////////////////////////////////////// > > > Hope this helps clear things up, > > Tibor. > > www.tiborballai.com > > --- In [email protected], Nick Middleweek <nick@> wrote: > > > > Hi, > > > > I've been told to put my getters before my setters when defining Interfaces > > and creating the Class functions... > > > > ... then Bind my getters. > > > > > > Is this a known practice? Any what's the benefit? Is it something to do with > > how Flex calls the getters when setting via the setters? > > > > > > > > Thanks, > > Nick > > >

