I have found that inspecting the Boolean property "initialized" in UIComponent 
is equivalent to determining if the creation complete event has fired for a 
UIComponent...from the docs for Flex SDK 3.5:

initialized:Boolean

A flag that determines if an object has been through all three phases of 
layout: commitment, measurement, and layout (provided that any were required).

http://www.adobe.com/livedocs/flex

I have a base ViewMediator that injects views and performs the following check:

[Autowire( view="true" )]
public function set view( value:* ):void
{
        logger.debug("AUTOWIRE :: view = " + value);
        this._view = value;
        
        // determine if the view has been initialized...
        // NO...listen for it's creation complete event
        if(this._view.initialized == false)
        {
                this._view.addEventListener(FlexEvent.CREATION_COMPLETE, 
onCreationComplete);
        }
        // YES...call the init() method to kick off the initialization of the 
view mediator
        else
        {
                this.init();
        }
        
        // don't get in GC's way if the view is removed
        this._view.addEventListener(Event.REMOVED_FROM_STAGE, cleanup);
}

-riley

--- In [email protected], "dfalling" <dfall...@...> wrote:
>
> I have a custom tab navigator that will be attached to a viewstack.  It needs 
> to know if the viewstack's children have been created or not.  This could 
> happen before it is attached to the viewstack or some time after due to 
> creationPolicy, so I absolutely can't just listen for the creationComplete 
> event.  Once I know it hasn't been created, I can watch it (and am planning 
> to), but I need a way to check beforehand.
> 
> --- In [email protected], "valdhor" <valdhorlists@> wrote:
> >
> > So, I still don't understand. How would you create a component without 
> > having a reference to it?
> > 
> > Also, if you have a public var thisComponentIsComplete:Boolean in your 
> > component that gets set when the creationComplete event fires, why can't 
> > you just ask the component if it has been created?
> > 
> > if(theNewComponentIJustGotAReferenceTo.thisComponentIsComplete)
> > {
> >     trace("This Component has been created");
> > }
> > 
> > 
> > 
> > --- In [email protected], "dfalling" <dfalling@> wrote:
> > >
> > > Man, I'm doing a terrible job communicating my problems.
> > > 
> > > So I want  way for other components to inspect each other to see if 
> > > they've completed.  I can't just listen to the event, because the 
> > > creation could have happened before I ever had a reference to the 
> > > component to start listening.  I'm wondering if there's a way to inspect 
> > > a component that you've just now been given a reference to, that may or 
> > > may not have created itself already.
> > > 
> > > 
> > > 
> > > --- In [email protected], "valdhor" <valdhorlists@> wrote:
> > > >
> > > > I should probably clarify a bit.
> > > > 
> > > > You could create your own creationComplete flag.
> > > > 
> > > > private var thisComponentIsComplete:Boolean = false;
> > > > 
> > > > then set it in your creationComplete event handler
> > > > 
> > > > private function onCreationComplete():void
> > > > {
> > > >     thisComponentIsComplete = true;
> > > > }
> > > > 
> > > > 
> > > > --- In [email protected], "valdhor" <valdhorlists@> wrote:
> > > > >
> > > > > If it has already fired then your event handler will have run.
> > > > > 
> > > > > 
> > > > > --- In [email protected], "dfalling" <dfalling@> wrote:
> > > > > >
> > > > > > Is there a publicly-exposed property on components that can be 
> > > > > > inspected to determine if they have finished creation yet?  I know 
> > > > > > I can listen for creationComplete, but what can I do if it may have 
> > > > > > already been fired?
> > > > > >
> > > > >
> > > >
> > >
> >
>


Reply via email to