Good question. Other than the doc, I don’t really know of any great sources of information. I’m not sure there is a single recommended way to use them, but I think of them as I would a state diagram or flow chart of a UI.
On 4/13/12 6:17 AM, "Bill Franklin" <bill.frank...@bayer.com> wrote: 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:3417152934_109333738] Bayer CropScience LP 8400 Hawthorne Road, Room 2447 Kansas City, MO 64120 Tel: +1 816 242 2148 Fax: +1 816 242 2047 E-mail: bill.frank...@bayer.com 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: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Alex Harui Sent: Thursday, April 12, 2012 3:22 PM To: flexcoders@yahoogroups.com 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" <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
<<inline: image.gif>>