updateDisplayList is called in the next render event. So, I would
assume updateDisplayList will be called once for each render no matter
how many times you call the invalidateDispayList in that cycle. Going
through commitProperties will ensure that you do not repeat any
complex calculations on the setter every time a value changes but
instead do it once in the commitProperties. You can add the button in
the createChildren() method but do any calculations on the sizes in
the measure.

As the documentation says:

"Calls to the commitProperties() method occur before calls to the
measure() method. This lets you set property values that the measure()
method might use."

--- In [email protected], Sherif Abdou <[EMAIL PROTECTED]> wrote:
>
> and would something like this call the invalidateDisplayList() 3
times or just once. I am not doing anything special just trying to
figure out best practices. 
> /**
> * 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;
> }
> if(_buttonDisplayChange){
> invalidateDisplayList();
> }
> if(true){
> invalidateDisplayList();
> }
> }
> 
> 
> 
> ----- Original Message ----
> From: Sherif Abdou <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Wednesday, February 6, 2008 6:19:31 PM
> Subject: Re: [flexcoders] Re: is this how to use commitProperties
> 
> and for measure() it only talks about the component itself so would
it be better to set a button(Child of the component) in the measure or
just do it in the createChildren( ); 
> 
> 
> ----- Original Message ----
> From: rueter007 <[EMAIL PROTECTED] co.uk>
> To: [EMAIL PROTECTED] ups.com
> Sent: Wednesday, February 6, 2008 5:57:18 PM
> Subject: [flexcoders] Re: is this how to use commitProperties
> 
> 
> you definitely can. but if there are several properties and each of
> them call invalidateDisplayLi st(), 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] ups.com, Sherif Abdou <sherif626@ ..> wrote:
> >
> > so why not just call invalidateDisplayLi st() 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;
> > invalidatePropertie s();
> > 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){
> > closeButton. visible=true;
> > invalidateDisplayLi st();
> > _closePolicyChanged =false;
> > }
> > }
> > 
> > 
> > 
> > ----- Original Message ----
> > From: ben.clinkinbeard <ben.clinkinbeard@ ...>
> > To: [EMAIL PROTECTED] ups.com
> > 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
> >
> 
> 
> 
> 
> 
> 
> 
> Looking for last minute shopping deals? Find them fast with Yahoo!
Search. 
> 
> 
> 
>      
____________________________________________________________________________________
> Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  Try it now. 
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>


Reply via email to