getStyle being an expensive call this is less than ideal.

No, setStyle is an expensive call, getStyle is not.

When regenerateStyleCache is called it populates the nonInheritingStyles and
inheritingStyles object of the UIComponent. So when you call getStyle() it
just maps to either of those object maps depending on if it is an inheriting
style or not.

The style proto chain is already created. there is not recursion whatsoever
with getStyle().

Peace, Mike

On 06 Mar 2007 08:57:46 -0800, Johannes Nel <[EMAIL PROTECTED]> wrote:

  yes i noticed it as well.
also when i specify a custom style in my css file the stytlechanged method
does not get called with propname being my customStyle (this of course is
not a massive problem as your style is still availible), but it means i have
to do a getStyle call to check if the user specified that style, and then go
and set it. getStyle being an expensive call this is less than ideal.




On 05 Mar 2007 19:23:49 -0800, Muzak <[EMAIL PROTECTED]> wrote:
>
>   Hi Mike,
>
> Thx for the reply.
>
> Is this documented somewhere?
>
> When I look at: "About overriding the styleChanged() method"
> http://livedocs.adobe.com/flex/201/html/skinstyle_149_5.html
> it doesn't mention anything about a null value being passed.
>
> So, to rephrase my initial question.
> - Are those 2 calls really necessary/useful?
> - If not, does making those method calls have any impact on an
> application as a whole?
>
> Meaning, if I have 100 components in an app, that's 200 method calls
> that do nothing.
>
> regards,
> Muzak
>
> ----- Original Message -----
> From: "Michael Schmalle" <[EMAIL PROTECTED]<teoti.graphix%40gmail.com>
> >
> To: <[email protected] <flexcomponents%40yahoogroups.com>>
> Sent: Tuesday, March 06, 2007 1:37 AM
> Subject: Re: [flexcomponents] styleChanged called twice during
> initialization process
>
> > Hi,
> >
> >> Is this something we should be worried about, unnecessary method
> calls?
> >
> > styleChanges() gets called when component's are initialize and proto
> chains
> > are created.
> >
> > null is passed when a component resets, just like styleName. It will
> only
> > matter is you have anything that gets rendered with like and
> >
> > var allStyles:Boolean = (styleProp == null || styleProp ==
> "styleName")
> >
> > So all you need to do is test and figure out what you want to be
> recreated
> > or painted when the value is null, thus use if() statements.
> >
> > Also, remember, you have the initialized property to do more granular
> checks
> > during initialization where null is passed twice.
> >
> > I think these calls are from regenerateStyleCache() or at least one
> is.
> >
> > Peace, Mike
> >
>
>


--
j:pn
http://www.lennel.org




--
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.

Reply via email to