When the creationComplete event is fired on a TitleWindow

View: New views
4 Messages — Rating Filter:   Alert me  

When the creationComplete event is fired on a TitleWindow

by powers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a title window that I'm creating and passing data to.  I want to create children of the title window based on this data and I don't want to show the title window until the children have been created and added to the title window.  

titleWindow = new SomeComponent();
titleWindow.data = someData
titleWindow.createSubChildren();
                               
PopUpManager.addPopUp(titleWindow, this);
titleWindow.center();

When I call the createSubChildren method, I get errors because it doesn't seem that any of the titleWindow's sub containers have been created. I thought using the new operator to create the component would create all of the children but it doesn't seem to happen until it is actually added using the PopupManager.  Any ideas?

RE: When the creationComplete event is fired on a TitleWindow

by Alex Harui :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Children are created in addPopUp (when added to a parent).  creationComplete may be fired in there as well.

________________________________
From: flexcoders@... [flexcoders@...] On Behalf Of powers [vic.powers@...]
Sent: Wednesday, November 04, 2009 10:29 AM
To: flexcoders@...
Subject: [flexcoders] When the creationComplete event is fired on a TitleWindow



I have a title window that I'm creating and passing data to. I want to
create children of the title window based on this data and I don't want to
show the title window until the children have been created and added to the
title window.

titleWindow = new SomeComponent();
titleWindow.data = someData
titleWindow.createSubChildren();

PopUpManager.addPopUp(titleWindow, this);
titleWindow.center();

When I call the createSubChildren method, I get errors because it doesn't
seem that any of the titleWindow's sub containers have been created. I
thought using the new operator to create the component would create all of
the children but it doesn't seem to happen until it is actually added using
the PopupManager. Any ideas?
--
View this message in context: http://old.nabble.com/When-the-creationComplete-event-is-fired-on-a-TitleWindow-tp26202032p26202032.html
Sent from the FlexCoders mailing list archive at Nabble.com.




Re: When the creationComplete event is fired on a TitleWindow

by reflexactions :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Components don't get initialized until added to a container and createChildren is called as part of the initialization process.

Since this is your own subclassed component you can override createChildren and call createSubChildren from there though you should check whether your data has been set before you try creating anything.

Additionally in the setter for your data you can check to see if the component is already initialized and if so directly call createSubChildren otherwise wait for initialization.

The TitleWindow by default is not made visible until after intialization so that should be ok.

We do something similar to this to load modules at runtime, passing in the Url or Class as the 'data'.

--- In flexcoders@..., powers <vic.powers@...> wrote:

>
>
> I have a title window that I'm creating and passing data to.  I want to
> create children of the title window based on this data and I don't want to
> show the title window until the children have been created and added to the
> title window.  
>
> titleWindow = new SomeComponent();
> titleWindow.data = someData
> titleWindow.createSubChildren();
>
> PopUpManager.addPopUp(titleWindow, this);
> titleWindow.center();
>
> When I call the createSubChildren method, I get errors because it doesn't
> seem that any of the titleWindow's sub containers have been created. I
> thought using the new operator to create the component would create all of
> the children but it doesn't seem to happen until it is actually added using
> the PopupManager.  Any ideas?
> --
> View this message in context: http://old.nabble.com/When-the-creationComplete-event-is-fired-on-a-TitleWindow-tp26202032p26202032.html
> Sent from the FlexCoders mailing list archive at Nabble.com.
>



Re: When the creationComplete event is fired on a TitleWindow

by powers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Great! Thanks for the explanation.
reflexactions wrote:
Components don't get initialized until added to a container and createChildren is called as part of the initialization process.

Since this is your own subclassed component you can override createChildren and call createSubChildren from there though you should check whether your data has been set before you try creating anything.

Additionally in the setter for your data you can check to see if the component is already initialized and if so directly call createSubChildren otherwise wait for initialization.

The TitleWindow by default is not made visible until after intialization so that should be ok.

We do something similar to this to load modules at runtime, passing in the Url or Class as the 'data'.

--- In flexcoders@yahoogroups.com, powers <vic.powers@...> wrote:
>
>
> I have a title window that I'm creating and passing data to.  I want to
> create children of the title window based on this data and I don't want to
> show the title window until the children have been created and added to the
> title window.  
>
> titleWindow = new SomeComponent();
> titleWindow.data = someData
> titleWindow.createSubChildren();
>
> PopUpManager.addPopUp(titleWindow, this);
> titleWindow.center();
>
> When I call the createSubChildren method, I get errors because it doesn't
> seem that any of the titleWindow's sub containers have been created. I
> thought using the new operator to create the component would create all of
> the children but it doesn't seem to happen until it is actually added using
> the PopupManager.  Any ideas?
> --
> View this message in context: http://old.nabble.com/When-the-creationComplete-event-is-fired-on-a-TitleWindow-tp26202032p26202032.html
> Sent from the FlexCoders mailing list archive at Nabble.com.
>