Components Within Components

I'm having some strange behavior that I'm trying to understand/work-around.

I have create a custom component which I call 'VComboBox' (this is the linkageID). This custom component is made up of two of Flash's builtin components, the first is a simple text label, the second is the ComboBox known as 'FComboBoxSymbol'. The instance of the combo box within my custom component is named 'comboObject'.

Now on my stage when I drag an instance of this custom component from my library to the stage, and name it 'myCustomComponent'. I can use the following code:

_root.myCustomComponent.comboObject.addItem("red", 0);

Then when I run the page it works fine. The combo is populated and clicking on the arrow indeed brings down the drop-down view of the combo box. However when I try to implement this fine piece of code dynamically I run into a MUCH different story. Below is the code:

var newControlName = "control" + instanceCounter++;
_root.attachMovie("VComboBox", newControlName, depth++);
_root[newControlName].comboObject.addItem("red", 0);

Now when I run the page it indeed creates a copy of my custom component. However nothing shows up inside, whereas it would display "red" before. And when I click on the arrow to drop the list down, nothing happens except for turning the entire combo box grey.

What gives? How could I make this work? I despirately need my components to work so that a database can dynamically create the needed fields to collect the data that it requires.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!