The label setter, like most setters, is extremely inexpensive. The label
doesn't get set into the TextField (which is expensive) until
commitProperties().

 

Gordon Smith

Adobe Flex SDK Team

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of ben.clinkinbeard
Sent: Friday, April 04, 2008 2:23 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Changing a property inside of
commitProperties?

 

Setting a label repeatedly could cause performance issues as
remeasuring a textbox is said to be fairly expensive.

Ben

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Troy Gilbert" <[EMAIL PROTECTED]>
wrote:
>
> > Things done in commitProperties() are generally wrapped in a check
to
> > make sure the underlying data has changed since last time. So in
your
> > myCustomData setter you would set the value of _myCustomData and
also
> > set _myCustomDataChanged = true. Then in commitProperties() you
would
> > do something like this:
> 
> Yeah, the point of that pattern is to avoid unnecessary work (for
> performance/efficiency reasons), which isn't a factor here.
> 
> > You also might try moving super.commitProperties() to the end of
your
> > override rather than having it at the beginning. I don't have any
> > memorized rules for when each is better but it can make a difference
> > in some circumstances.
> 
> I'll give that a shot... thinking about it, that will probably resolve
> the issue for me in this situation as it will dirty the label *before*
> FormItem handles it.
> 
> I'd still be curious about handling this more generally for
> commitProperties, for example, if I was dependent on the updates
> performed by my super class such that calling super.commitProperties()
> before my code was necessary.
> 
> Troy.
>

 

Reply via email to