This content has been marked as final. Show 4 replies
When you dynamically create a component, you need to store a reference to it in som instance level structure, like an associative array.
Then, you can use that reference to manipulate the component instance, like assigning a dataProvider, or adding an event listener.
that's true! But i used the same reference to create all components (really i must use the same reference) and when i try to bind the components with their respective classes the reference has the last component created...
private var _oDynComponents:Object = new Object(); //assoc array
function add child components():void
var cboNew:ComboBox = new ComboBox();
oDynComponents["myCBO"] = cboNew;
then later you can do:
var cboCurrent:ComboBox = oDynComponents["myCBO"];
cboCurrent.dataProvider = myArryCollection;