View Full Version : duplicateMovieClip

05-02-2003, 12:50 AM
I am very new to AS. I have a movie clip which contains a dynamic text field, button, listbox etc. I also have a function to duplicate several instances of the movie clip. My problem is that on the duplicated instances of the mc the listbox etc will not function correctly... to the extent that it does it will only effect the original mc. Can someone please explain to me how I can get my duplicated mc's to keep the functionality of the original mc?

Any assistance would be greatly appreciated.

cheers Kym

05-02-2003, 07:10 AM
Hi kwimbi,
It is hard to tell what you exactly do without some code. Try and upload some code. Maybe you load in the wrong level or because the path is not right. The latter is often the case. Try and use the debugger to view the content of the variables.

05-02-2003, 07:37 AM
Thanks for the response. Sorry for the lack of precision. I have a mc named square_mc it contains a button, listbox, some dynamic text, an empty mc for loading jpegs dynamically in response to the users selection from the list box, once the user selects from the list box it disapperas. I then have some code to produce duplicates of the square_mc movie clip but these lack the functionality of the original movieclip. here is some of the code:

actionscript layer:

//hide list box initially

// here is the line that sets the ChangeHandler function name
// here is the line that defines the ChangeHandler function
_root.square_mc.showDog = function() {

//show text
square_mc.dog_txt.text = square_mc.dogListBox_lb.getSelectedItem().label;
//hide list box
//load image

//Create the grid
function createGrid(){
var cols = 3;
var rows = 3;
var xSpread = 200;
var ySpread = 200;
for (i=0; i<rows*cols; i++) {
var clip = attachMovie("square_mc", "Square_mc"+i, i);
clip._x = (i%cols)*xSpread;
clip._y = Math.floor(i/cols)*ySpread;

Button in square_mc to hide show listbox:

on (release){

Hope this helps you help me?

Thanks again for the input.

Cheers Kym

05-02-2003, 08:43 AM
Hi Kym,
I haven't got the time to have a good look at your code, but do I get this right:
You create dynamically a clip with an empty clip, listbox and button as children.
Then you want to multiply this clip in a kind of array?
If so, I think you should not use attachMovie but duplicateMovieClip. Attach only works when you copy out of the Library (well there is this bit with initObject that you can pass, but I have never used this).
So either include the originals in the library, copy the clips with attach and then fill them with your pictures or create your clip, fill it and duplicate them. I would make sure you have loaded the clip before copying it, to avoid unwanted effects.
Hope this helps.