View Full Version : DuplicateMovie Combobox problem

11-21-2004, 07:57 PM
I am populating some comboboxes with a dynamic array (from a DB query) and I want to duplicate the comboboxes with a duplicate movie action. I have placed the comboboxes inside a parent mc labeled "linkrow_mc". The problem is once I duplicate the movie clip, linkrow_mc, I can't seem to populate the comboboxes in the newly created instance. Here is some of my code:
linkrow_mc.fieldname_cb.setDataProvider(fieldNames _rs);
//the above line successfully populates the oringinal combobox
linkrow_mc.duplicateMovieClip("linkrow_"+i+"_mc", i);
_root["linkrow_"+i+"_mc"]._y = linkrow_mc._y + (24*i);
//this line does not populate the duplicated combobox. ?why?
What am I missing?

Thanks, Kevin

12-08-2004, 04:15 PM
I solved this problem. I discovered that the combo box actually takes a decent amount of time to load when duplicated or attached. I was trying to populate the box before it had completely loaded. Essentially what I did to solve the problem, is before I populated the combobox, I ran a test to make sure it had completely loaded.


12-09-2004, 07:44 PM
I attach movieclip with a combobox in scrollpane and outside i want to fill it but i doesn't work.
And i think that i have the same problem.
can you show me the code?

thank you :)

12-10-2004, 10:09 PM
the script is the standard script used to populate the combo box.


Using my solution, the trick is all about where you put it. In my case I put the combobox inside another movieclip which has two frames and two layers (actions & combobox). On the second frame of the actions layer I put a key frame and added the actionscript:


On the combobox layer I put in the combo box spanning frame one & two.

That's it. I then can load this movie clip from a duplicate movie or attach movie action. When the movie clip loads it will not move on to the frame two populating script until frame one, which contains the combobox, has completely loaded.

If you have problems or questions, post a sample file and I can look at it.

Alternatively, you can set up a function to check whether the movieclip is loaded before you populate. You could do this a variety of ways using an onLoad event handler or a setInterval function to keep checking the movieclip's properties. I guess it all depends on your scripting style, which will determine the better approach for you.

Take care, Kevin