PDA

View Full Version : DuplicateMovieClip disappear


zai
02-25-2002, 07:12 AM
:( Does anyone encounter the problem of previously duplicated mcs disappear when new duplicated mcs are create in another action.
:p To make it clear, this is what I encounter.
I created this mc called line_dot.
Then there are 2 buttons that will draw 2 straight line parallel to each other by duplicating the line_dot;1 button =1 line.
When I draw 2nd line, some duplicated line_dot disappear from line 1.
I had checked that they were given different instance name.:confused:

sfa
02-25-2002, 07:43 AM
it might because you are giving them the same depth.

SFA

zai
02-26-2002, 12:15 AM
I have try using different depth for the duplicated mcs, but no luck; not working.
:confused: Isn't the depth refers to the stacking order when mcs overlaps?
In my problem, there are no overlapping of the mcs; 2 parallel lines.
:( So what is the real problem ??? Your help is greatly appreciated.

sfa
02-26-2002, 07:40 AM
the preoblem is not overlapping, it is just that you cannot duplicatre two movies onto the same depth. It is hart to say what your problem is, can you post some code or a sample file?

SFA

zai
02-28-2002, 12:12 AM
:p Well, here are the codes.
//The main function:
function clonedot (xpos, ypos, amount,name,depthNum) {
//_root.line._alpha = "100";
count = 1;
while (count<amount) {
_root.line.duplicateMovieClip(name+count, count+depthNum);
setProperty (name+count, _y, ypos-count*11);
setProperty (name+count, _x, xpos);
count += 1;
}
//_root.line._alpha = "0";
}

//Button 1:
on (release) {
_root.clonedot(102, 395, 28,linei,0); //x=102,y=395,28dots,name=linei+1,+2...,depth=0+1,+2 ..
//_root.box1._alpha = "100";
//nextFrame ();
}

//Button 2:
on (release) {
_root.clonedot(135, 395, 24,lineii,30); //x=135,y=395,24dots,name=lineii+1,+2...,depth=30+1, +2..
//_root.box2._alpha = "100";
//nextFrame ();
}
I have change the name of MC to "line".
Hopefully, this is helpful to you.
Thank you.

pixelwit
02-28-2002, 10:28 PM
I think SFA hit it on the head. It look like you're overwriting clips that are on the same depth.

Every time you run your "clonedot" function, you reset count to 1. Every time you call the function from the button you specify the same depth number.

You can probably make it work if you put this line of code "count = 1;" outside of your "clonedot" function.

Hope it helps,

-PiXELWiT
http://www.pixelwit.com

zai
03-01-2002, 12:28 AM
Thanks pixelwit, but my function still cannot work.:(
I have change the codes as follows:

count = 1; //for different depth
function clonedot (xpos, ypos, amount,name) {
_root.line._alpha = "100";
i = 1 //a different counter
while (count<amount) {
_root.line.duplicateMovieClip(name+count, count);
setProperty (name+count, _y, ypos-i*11);
setProperty (name+count, _x, xpos);
count += 1;
i += 1;
}
_root.line._alpha = "0";
}
//button2
_root.clonedot(135, 395, 52,lineii);

Why is it not working ?
When button1 calls, the depth should be 1~27
when button2 calls the depth should be 28~51
I really have no clue of where the problem lies.
Please, somebody help me.
Thanks in advance:)

Ricod
03-01-2002, 07:58 AM
Since pixelwit and SFA were already helping u ... may be that its not in the function at all thats going wrong ... Maybe if we saw the zipped fla ?

zai
03-01-2002, 11:57 PM
You are right, Ricod. It's easier to understand the problem through the fla.
Well, here's the fla and thanks for helping me.