2 Replies Latest reply on Nov 27, 2006 1:00 AM by Peter Lorent

    ComboBox problems when in a MovieClip loaded at runtime


      I hope someone out there can help me with this problem: I have a ScrollPane that contains a MovieClip that to which I attach several other MovieClips at runtime in response to user inputs using attachMoveClip() (both MCs are in my library and set to export for actionscrip in first frame). Each of those MovieClips contains a ComboBox.

      At runtime, I attach the MovieClip containing the ComboBox, then I set the dataProvider property for the ComboBox to a list (Array) of data/label value pairs. I then try to set the text property of the ComboBox to a "Please select a value" message and then I add a couple of listeners.

      Setting the dataProvider property sort of works: the ComboBox displays the proper dropdown list when clicked, but nothing happens when I select an item from the dropdown list - i.e., the selected value doesn't display in the ComboBox's TextField.

      Setting the text property doesn't seem to work: the value doesn't display in the ComboBox's TextField, but oddly, if I trace the ComboBox's text property, it outputs the correct message.

      Also, none of the event handlers work at all.

      I tried all of the same code on a ComboBox that isn't created dynamically, and it all works.

      Here's the code. The first set of code is the part I need to get working. It sets up the ComboBox after the MovieClip it is contained in is attached to the parent MovieClip. The second set of code was my test code to see if this worked on a ComboBox that isn't created at runtime. It all works properly.