Alex, where is good information on states and how/when/where to use them?

Freundliche Grüße / Best regards,
Bill Franklin
Computer Integrated Mfg.

[cid:[email protected]]
Bayer CropScience LP
8400 Hawthorne Road, Room 2447
Kansas City, MO 64120
Tel: +1 816 242 2148
Fax: +1 816 242 2047
E-mail: [email protected]
Web: http://www.bayercropscience.com

Vorstand: Sandra E. Peterson, Vorsitzende   |  Lykele van der Broek, Achim 
Noack, Rüdiger Scheitza, Michael A. Schulz
Vorsitzender des Aufsichtsrats: Werner Baumann
Sitz der Gesellschaft: Monheim am Rhein   |   Eintragung: Amtsgericht 
Düsseldorf, HRB 46985

From: [email protected] [mailto:[email protected]] On Behalf 
Of Alex Harui
Sent: Thursday, April 12, 2012 3:22 PM
To: [email protected]
Subject: Re: [flexcoders] setStyle, preinitialize and initialize



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" <[email protected]> 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


________________________________________________________________________
The information contained in this e-mail is for the exclusive use of the 
intended recipient(s) and may be confidential, proprietary, and/or 
legally privileged.  Inadvertent disclosure of this message does not 
constitute a waiver of any privilege.  If you receive this message in 
error, please do not directly or indirectly use, print, copy, forward,
or disclose any part of this message.  Please also delete this e-mail 
and all copies and notify the sender.  Thank you. 

For alternate languages please go to http://bayerdisclaimer.bayerweb.com
________________________________________________________________________

<<inline: image001.gif>>

Reply via email to