I have built a custom component which I call 'VComboBox'. This component is composed of a single label and an instance of Macromedia's builtin ComboBox 'FComboBoxSymbol'. I named the instance of the FComboBoxSymbol to 'comboObject'.
Now when I drag a copy of my component onto the stage and in ActionScript I use the following code:
_root.myVComboInstance.comboObject.addItem("red", 0);
It works and adds the item into the combo box inside my custom component. However when I dynamically create an instance of my VComboBox it does not work at all, like below:
_root.attachMovie("VComboBox", myNewCombo, depth++);
_root.myNewCombo.comboObject.addItem("red", 0);
The combo appears but however no item is added. And when I click on the arrow for the combo to drop-down nothing happens. I am trying to find out what I am doing wrong? Is there a way to make this work? Also why is my custom component acting completely different based on whether it was created at design-time, or whether it was created dynamically at run-time? Any assistance would be greatly appreciated.
Now when I drag a copy of my component onto the stage and in ActionScript I use the following code:
_root.myVComboInstance.comboObject.addItem("red", 0);
It works and adds the item into the combo box inside my custom component. However when I dynamically create an instance of my VComboBox it does not work at all, like below:
_root.attachMovie("VComboBox", myNewCombo, depth++);
_root.myNewCombo.comboObject.addItem("red", 0);
The combo appears but however no item is added. And when I click on the arrow for the combo to drop-down nothing happens. I am trying to find out what I am doing wrong? Is there a way to make this work? Also why is my custom component acting completely different based on whether it was created at design-time, or whether it was created dynamically at run-time? Any assistance would be greatly appreciated.