1 Reply Latest reply on Aug 4, 2011 12:34 PM by Flex harUI

    Flex 3/4 Initialization Timing Changes?


      Hi there.  This isn't end-of-the-world critical, but I'm trying to better understand what's going on here.


      We have a relatively large and complex business app (several hundred classes split into a core application framework plus multiple dynamically-loaded product modules), originally written in Flex 3.2.  As part of our new release, we are taking the chance to port it over to Flex 4.5; I've spent the past week doing so.  We're continuing to use the Halo theme for the time being, to minimize the initial disruption.


      I've pretty much gotten it working, but I'm still trying to understand the key behaviour change that I've observed.  A lot of our code is failing at initialization time.  I'm still nailing down exactly what's different, but the most obvious bit is that it seems like, in commitProperties(), properties that refer to other objects in the same parent don't exist yet, where they previously did.  So I'm getting null pointer exceptions where I wasn't previously.


      Similarly, I have a few objects where the property refers to the object itself.  They're graphing objects, which have a property that describes how to set up the dataFunction.  This property is typically set to one of several functions available on the object.  So graph "foo" would set this function to "foo.useDateForY" or some such, using one of these utility functions on the class that says how to set up the graph.  This previously worked, but now the property is failing because "foo" is null when it is trying to resolve the property value.  This seems likely to be related to the above.


      Finally, I've also observed what appear to be differences in the resolution of the lifecycle for non-visible objects.  Again, I haven't had time to nail this down precisely, but it feels like I used to get CREATION_COMPLETE in a bunch of cases that aren't getting it any more -- specifically, this seems to be happening for objects that I'm building up before adding them to the visible graph.  I build lots of screens upfront when a product is loaded, but don't actually add them into the tab structure until they are invoked.  Similarly, we have popups that we want to be populating as we go, long before they are displayed, but I don't seem to be getting CREATION_COMPLETE for them when I used to.


      So it seems like something has changed subtly in the UIComponent lifecycle, having to do with the timing of resolving IDs, setting properties to them, and calling commitProperties(); maybe also something having to do with how parenting relates to finishing the lifecycle.  Does anybody have a clue what I'm talking about here?  And is there a document somewhere that describes the timing changes more clearly?  I've seen several documents talking about 3 -> 4 changes, but haven't noticed anything on this particular topic...

        • 1. Re: Flex 3/4 Initialization Timing Changes?
          Flex harUI Adobe Employee

          Yes, the timing of when child objects are created has changed relative to

          when the constructor runs, but the lifecycle methods and events have not

          changed.  If you rely on commitProperties to resolve things, it should be



          The only cases I've seen where creationComplete doesn't fire is if there is

          an invalidation loop going on which is slightly more possible if using

          multiline text controls whose height depends on width or vice-versa.