The doc is assuming you are calling setStyle on the component dispatching the 
event, not its children.  Why aren’t you using states for this?


On 4/11/12 3:40 PM, "flexwdw" <flex...@yahoo.com> wrote:






So, I've run into this before but I don't recall it being the headscratcher it 
has become today....

I'm using Flex 3.5 in an app.  I have an MXML class with a bunch of UI in it.  
I have been asked to add a switch that causes the positions of some of the 
different child components to change.  The components use constraint-based 
layouts, so this is going to amount to modifying their left, right, top, and 
bottom styles.  This only needs to happen once per object creation.

In the docs:
http://livedocs.adobe.com/flex/3/html/help.html?content=styles_08.html

"Some applications must call the setStyle() method during the application or 
object instantiation. If this is the case, call the setStyle() method early in 
the instantiation phase. Early in the instantiation phase means setting styles 
from the component or application's preinitialize event, instead of the 
creationComplete or other event. By setting the styles as early as possible 
during initialization, you avoid unnecessary style notification and lookup. For 
more information about the component startup life cycle, see Improving Startup 
Performance."

Putting these style sets in preinitialize is impossible because the children 
have not been setup and are null.  At this point, I am making the calls in the 
handler for the initialize event.  Is there an acceptable way to do this 
without having to create two versions of the class subclass the children?






--
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui

Reply via email to