1 Reply Latest reply on Mar 10, 2008 10:30 PM by Gregory Lafrance

    Order of events

    SiHoop Level 1
      I'm having a difficult time understanding how to make sure all of my object have loaded properly. I don't know when to use initialize vs. preinitialize ve creationComplete and the result is that some functionality, especially when defined in classes, seems to disappear. For example, I have a simple button class that is no longer working. When I play around with the <Application> event handlers, the button will work, but other objects (e.g. a main canvas) will no longer load. So my question is: Are them some good heuristics to follow concerning the order in which objects are loaded into Flex?
        • 1. Re: Order of events
          Gregory Lafrance Level 6
          preinitialize - Dispatched when the component has been attached to its parent container, but before the component has been initialized, or any of its children have been created. In most cases, this event is dispatched too early for an application to use to configure a component.

          initialize - Dispatched when a component has finished its construction and its initialization properties have been set. At this point, all of the component's immediate children have been created (they have at least dispatched their preinitialize event), but they have not been laid out. Exactly when initialize events are dispatched depends on the container's creation policy, as described later in this section.

          creationComplete - Dispatched when the component, and all of its child components, and all of their children, and so on have been created, laid out, and are visible.