Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-21-2004, 07:57 PM   #1
honers
Registered User
 
Join Date: Jul 2002
Location: New York
Posts: 41
Default DuplicateMovie Combobox problem

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:
Code:
linkrow_mc.fieldname_cb.setDataProvider(fieldNames_rs);
//the above line successfully populates the oringinal combobox
	for(i=1;i<14;i++){
		linkrow_mc.duplicateMovieClip("linkrow_"+i+"_mc", i);
		_root["linkrow_"+i+"_mc"]._y = linkrow_mc._y + (24*i);
                _root["linkrow_"+i+"_mc"].fieldname_cb.setDataProvider(fieldNames_rs);
//this line does not populate the duplicated combobox. ?why?
	}
What am I missing?

Thanks, Kevin
honers is offline   Reply With Quote
Old 12-08-2004, 04:15 PM   #2
honers
Registered User
 
Join Date: Jul 2002
Location: New York
Posts: 41
Default

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.

-Kevin
honers is offline   Reply With Quote
Old 12-09-2004, 07:44 PM   #3
robgie
Registered User
 
Join Date: Oct 2004
Posts: 5
Default

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
robgie is offline   Reply With Quote
Old 12-10-2004, 10:09 PM   #4
honers
Registered User
 
Join Date: Jul 2002
Location: New York
Posts: 41
Default

the script is the standard script used to populate the combo box.

this.combobox_cb.setDataProvider(somearray_array);

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:

stop();
this.combobox_cb.setDataProvider(somearray_array);

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
honers is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:43 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.