there are also more advantages to using commitProperties when you have properties that depend on one another. Probably not a big deal in your example.
http://livedocs.adobe.com/labs/flex3/html/help.html?content=ascomponents_advanced_3.html --- In [email protected], "rueter007" <[EMAIL PROTECTED]> wrote: > > you definitely can. but if there are several properties and each of > them call invalidateDisplayList(), it could be a slight performance > problem as you are redrawing for every change. Instead if you do it in > the commitProperties, you call it once for all the changes. > > - venkat > http://www.venkatj.com > > --- In [email protected], Sherif Abdou <sherif626@> wrote: > > > > so why not just call invalidateDisplayList() on the setter itself. > Thanks > > /** > > * Used to Determine whether or not there was a change in the Close > Policy > > */ > > private var _closePolicyChanged:Boolean; > > /** > > * Internal Value for the ClosePolicy so we can react > > * accordingly > > */ > > private var _closePolicy:String; > > > [Inspectable(defaultValue="close_always",enumeration="close_always,close_rollover,close_never,close_selected")] > > public function set closePolicy(value:String):void{ > > if(_closePolicy !=value){ > > trace(value); > > _closePolicy=value; > > _closePolicyChanged=true; > > invalidateProperties(); > > dispatchEvent(new Event("closePolicyChanged")); > > } > > } > > [Bindable(event="closePolicyChanged")] > > public function get closePolicy():String{ > > return _closePolicy; > > } > > /** > > * Create the CommitProperties so we determine if there is a need > > * to change the closePolicy Buttons > > */ > > override protected function commitProperties():void{ > > super.commitProperties(); > > if(_closePolicyChanged){ > > closeButton.visible=true; > > invalidateDisplayList(); > > _closePolicyChanged=false; > > } > > } > > > > > > > > ----- Original Message ---- > > From: ben.clinkinbeard <ben.clinkinbeard@> > > To: [email protected] > > Sent: Wednesday, February 6, 2008 2:42:41 PM > > Subject: [flexcoders] Re: is this how to use commitProperties > > Looks right to me except you should validate that the new value is > > actually different than the existing value in your setter before > > setting the flag and whatnot. > > > > HTH, > > Ben > > > > --- In [EMAIL PROTECTED] ups.com, Sherif Abdou <sherif626@ ..> wrote: > > > > > > my bad, i for some reason sent it to flexComponents instead instead > > of flexcoders so sorry for double post > > > i am just wondering if this is how it usually gets used > > > /** > > > * Used to Determine whether or not there was a change in the Close > > Policy > > > */ > > > private var _closePolicyChanged :Boolean; > > > /** > > > * Internal Value for the ClosePolicy so we can react > > > * accordingly > > > */ > > > private var _closePolicy: String; > > > [Inspectable( defaultValue= "close_always" ,enumeration= > "close_always , > > close_rollover , close_never, close_selected" )] > > > public function set closePolicy( value:String) :void{ > > > _closePolicy= value; > > > _closePolicyChanged =true; > > > this.invalidateProp erties(); > > > dispatchEvent( new Event("closePolicyC hanged")) ; > > > } > > > [Bindable(event= "closePolicyChan ged")] > > > public function get closePolicy( ):String{ > > > return _closePolicy; > > > } > > > > > > /** > > > * Create the CommitProperties so we determine if there is a need > > > * to change the closePolicy Buttons > > > */ > > > override protected function commitProperties( ):void{ > > > super.commitPropert ies(); > > > if(_closePolicyChan ged){ > > > invalidateDisplayLi st(); > > > _closePolicyChanged =false; > > > } > > > } > > > > > > > > > > > ____________ _________ _________ _________ _________ _________ _ > > > Be a better friend, newshound, and > > > know-it-all with Yahoo! Mobile. Try it now. > > http://mobile. yahoo.com/ ;_ylt=Ahu06i62sR 8HDtDypao8Wcj9tA cJ > > > > > > > > > > > > > > > > ____________________________________________________________________________________ > > Looking for last minute shopping deals? > > Find them fast with Yahoo! Search. > http://tools.search.yahoo.com/newsearch/category.php?category=shopping > > >

