views:

1094

answers:

1

I have a flex application that has three tabs. Each of these tabs has a component that loads a ‘form’ that has a dropdown combo box. These combo boxes depend on external data in order to populate correctly. Currently the first tab is being created and the data that should be populated in the combo box is not in there. The combo box for the second tab is populated with the required data.

What I’d like to do is create an event that is dispatched after the data is loaded. When this event happens I’d like to then create these tabs, or the components of the tabs. Is there a way to wait for the data to be loaded before the application creates the components?

+1  A: 

You could create the components in actionscript.

this code will create a ComboBox:

var newBox = new ComboBox();
newBox.dataProvider = aDataProvider;
// You could alternativley use (v/h)box.addChild(newBox)
//     to add it as a child of a specific element
Application.application.addChild(newBox);

You can use that sort of technique to create the components in actionscript, you will still need to set all the properties that are usually set in mxml, but they all have the same names.

Alex