Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




DuplicateMovieClip



Hi Guys,

I haven't been around here in ages, was stoked to see the re-design and things seem to be going well round these parts.

I've run into a problem with duplicateMovieClip:

I would like to duplicate a movieClip from inside a container clip to the _root.
i.e.


Code:
container.ball1.duplicateMovieClip('circle',_root.getNextHighestDepth());
I'm not getting it right and the circle clip is created in the container clip



Ultrashock Forums > Flash > Flash Newbie
Posted on: 2008-02-12


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

DuplicateMovieClip
Im duplicating a movieclip and the clips that are duplicated sit on top of my other layers in the movie... I want the duplicated movie clips to lay under my other layers..

Any suggestions?

I'll provide you with the FLA if you want : )

How To Do DuplicateMovieClip?
hi!

I've got a problem that I'm sure will be very easy for you guys to solve.

Here is the my object tree:

_level0.Box
_level0.Item

that means that at the beginning of the movie I have 2 objects on the scene: Box and Items. Both objects are in the root.

Here is the list of the objects after some action:

_level0.Box
_level0.Item
_level0.Box.Item2

You see that Iwant to duplicate Item to the Item2(Item2 should be within the Box).

What should I do? I read all that we have here at this forum, but not found anything for such a simple problem.

Please help me!!!

DuplicateMovieClip - Need Little Help
hi people! i got a small actionscript problem. i think i need the dublicatemovieclip (what a word! ) but i don't understand it:

duplicateMovieClip ("TARGET", "NEWNAME", DEPTH);

i think the target is the movie to dublicate, and the new name is...the name of the dublicatet movie , but what the hell is depth??
if i dublicated the mc can i set any properties too?
thx for answers

Duplicatemovieclip()
I am having a performance problem and I would like to know if the "duplicatemovieclip" call is doing it.
I am using duplicatemovieclip to create a menu of titles. Where each movie clip is hold 1 title. I use duplicatemovieclip to create the rest of the titles and rename each as I create it by duplication.
But this is causing the main flash movie (which holds this menu) to drag (really really drag!) at startup.
Does the duplicate movie clip really slow down the performance ? Also given my situation, do you think there is any other way to do it.


Shreeram

Help With DuplicateMovieClip ... Please
Can anybody help me!!! I have a movieclip duplicating (imatating snow fall) and it takes up alot of processor speed, which limits the amount of extra animation I can put into the movie. I've tried using unloadMovieClip but it does'nt work, what I would really like to do is slow down the snow until it stops completely ... can anybody help me ... please!!!

Ben.

Duplicatemovieclip
Hi,
I am using the below script, I dont particular understand it.....
But I know what I want it to do.
For some reason or another its not duplicate the name of the old instances to the new instances its creating.
Is there any way for it to copy the name of the instance it duplicates.

kv is the name of my movie clip which contains serveral other movie clips , which I need to keep the name of.

while (Number(n)<19) {
n = Number(n)+1;
bn = "kv" add n;
duplicateMovieClip ("kv", bn, n);
setProperty (bn, _x, Number(getProperty(bn, _x))+Number(n*getProperty(bn, _width)));
setProperty (bn add "/b", _x, getProperty (bn add "/b", _x) + (random (20)+1));
set (bn add ":n", n);
}


If any one can help it would be very appriacted.
Cheers
Kaan.

DuplicateMovieClip-- Please Help
In my game that i am making, the movie clip has the following code:
===================================
onClipEvent(load){
randomizer = 39

if (randomizer == 39){
duplicateMovieClip(_root.diamond, "diamond"+i, i)
setProperty("diamond"+i, _x, 100);
setProperty("diamond"+i, _y, 100);
i = i+1
trace("made it");
}
}
=====================================
It is on a LOAD event clip since i only want this action to happen once at the beginning. The first thing that happens is the variable "randomizer" gets a value (in the final version this will look more like "randomizer = random(50)" or somthing). Next it checks if randomizer equals 39 (wich of cource it does but later this WILL be random). Since it does equal 39, it then tries to duplicate the movie clip that is located on the mian timeline, named diamond. But it doesnt work...

This code DOES work if i put it in a button, and say (instead of onClipEvent(Load)) on(release){ then code, it DOES work when i click it... But if its in a movie clip, it wont... Any help? If you have any idea, i would realy appretiate help Thanks!!

Elyxia

DuplicateMovieClip
Hello there,

I have a MovieClip "dot2" inside another MC "dot1"
I would like to duplicate "dot2" at the root of the movie.

example:
duplicateMovieClip (_root.dot1.dot2, _root."dot2"+i, i);

But '_root."dot2"+i' dosen't work. Is there a way to put my duplicate movieClips at the root of the time line??

Thanx for any reply,
Francois.

DuplicateMovieClip
beginner's question:

I want to use the duplicateMovieClip command to help populate a simple menu list of dynamic text fields.

1. Will I need to create a movie to contain the dyn text fields? (I assume I cannot call duplicateMovieClip on text fields. Can you in Flash MX?)

2. How do I pass the vars i need into this movie clip? Such as the dyn text varname? I know I can name the new movie clip, but it doesn't seem obvious to me how to name the dyn text field. they need to have the name ["faqa" + variablename]

thanks!

DuplicateMovieClip Help
ok, final question then i can kiss this project goodbye (for a bit).

i have 3 dynamic text fields that i populate with data from an external xml file. these contain information about articles. col1 = date, col2 = author, col3 = title. simple enough. however, for the fourth column i want to have buttons that will load the article.xml into another textfield. i'm a bit muddled atm on how to set this up.

first question is how do i duplicate buttons? i guess i have to put it within a holder movieclip. but where do i put the loop to duplicate that clip? the loop i tried looked something like:

i = 0;
while(i<xml1.firstChild.attributes.articles) {
duplicateMovieClip(buttonholder, "buttonholder"+i, i);
setProperty("buttonholder"+i, _y, i*16);
i++;
}

but im not sure where to place it :| need to call it with onClipEvent(load) so within the button holder?

to compound the problem, i want the article listing to be scrollable, and the articles to be scrollable. so i have to put the duplicated movie clips in another holder which i can then scroll.

i think i'm tying myself in knots. probably making this harder then it actually is. all i want is an article listing, then to be able to pull the article.xml file's into the swf and display them in the same area once a user clicks it.

any help, links, suggestions (anything!) greatly appreciated.

DuplicateMovieclip
i have some code where I use attachMovie, and i want to change this to duplicateMovieclip. how do i do that??

for (i=0; i<antallBokstaver; i++) {
attachMovie("ordtilskjermMC", "ordtilskjermMC"+i, i);
eval("ordtilskjermMC"+i)._y = 25;
eval("ordtilskjermMC"+i)._x = eval("ordtilskjermMC"+(i-1))._x+eval("ordtilskjermMC"+i)._width;
// set display in each of the duplicated mc's to contain each letter of the chosen words


tnx!

How Do You DuplicateMovieClip?
say I have mcDot and I want 20 of them on stage, how do I duplicate it 20 times and have each instance have a random x and y position and rotation?

DuplicateMovieClip()
How do you place objects in front of duplicated movie clips? When I use duplicateMovieClip() all of the layers on the stage are placed behind the duplicated movie clips. Thanks.

DuplicateMovieClip
I've been playing around with this and all seems straightforward when it it's triggered by a button. The problem is I want to duplicate movies from within a MC with the command in the actions of frame 1 in that timeline.
When I do this Flash tells me I've got scripts that will take too long to process and I should stop them running.
Harrumph.
Ta.

DuplicateMovieClip ?
ok i'm back again....lol . What i've got so far is a button and a pic in a MC (instance MC) . When the mouse runs over the button the MC fades.....ect . What i need is on mouseover the MC needs to duplicate itself, but for some odd reason it dosen't work .

on the button i've got

Quote:




on (rollOver) {
_root.fadding_mc = true;

}
on (rollOut) {
_root.fadding_mc = false;
}




and on the MC i've got

Quote:




onClipEvent (enterFrame) {
if (_root.fadding_mc == true) {
duplicateMovieClip (MC, MC2, 1);
_root.MC2._x = 313;
_root.MC2._y = 75;
if (_root.MC._alpha>0) {
_root.MC._alpha = _root.MC._alpha-1;
}
} else {
_root.MC._alpha = _root.MC._alpha+1;
}
}




thanks in advance

DuplicateMovieClip
One of the most usefull techniques in Flash is duplicating movie clips. Its a little different in MX. Heres a simple script that will have you creating rows and columns in no time:


Code:

for (x=1; x<10; x++) {
newClip = "mc" + x;
mc.duplicateMovieClip(newClip,x);
this[newClip]._y = mc._y + (mc._height *x);
mc._visible = false;
}
Later, I'll post how to assign varibles from an array of data (external,internal) into each duplicated clip.

enjoy

tutash

DuplicateMovieClip
Which syntax should I use to duplicate a MC inside another MC?
I'm trying to duplicate the MC called "box" inside the MC called "square".
When I use This AS :

for (i=0; i <5; i++) {
duplicateMovieClip(_root.square["box"],_root.square["box"+i],i);
setProperty(_root.square["box"+i],_x,i*40);
}

It doesn't copy the MC "Box" 5 times inside the MC "square"!!

Obviously, there's something wrong with the parameters inside the duplicatemovieclip and setproperty, but can anybody tell me what's wrong??

DuplicateMovieClip
I'm using the following Action Script to duplicate a movie clip named star1 when I rollover a button.

on (rollOver) {
x=214;
amount = 9;
while (amount > 0) {
duplicateMovieClip (_root.star1, "mc" + i, i);
_root["mc" + i]. _x= x
i++;
x+=10;
amount--;
}
}

this all works fine, but what I need to know is how do I tell all my duplicated movie clips to play frame number 2 as at the moment they all stop on frame 1.

This is doing my head in

Cheers

Mark

DuplicateMovieClip
Q) I am doing a duplicateMovieClip. I have the following code (which works):

// MC instance name is 'selectButton'
copyCount++;
>> duplicateMovieClip (this.selectButton, "selectButton" + copyCount, copyCount);
setProperty (this.selectButton1, _x, barXPosition);
setProperty (this.selectButton1, _y, barYPosition);
this.selectButton1.mainButton = TITLEARRAY[titleCount];

Unfortunately it's hardcoded (selectButton1, selectButton2...). I'm trying to make this more generic (a variable) so I can put this logic in a FOR loop and do this logic one time versus N times.

copyCount++;
>> var newClip = "selectButton" + copyCount;
>> duplicateMovieClip (this.selectButton, newClip, copyCount);
setProperty (this.newClip, _x, barXPosition);
setProperty (this.newClip, _y, barYPosition);
this.newClip.mainButton = TITLEARRAY[titleCount];

This doesn't work. How can I accomplish this? Thank you in advance!

DuplicateMovieClip
I am trying to figure out how to use the duplicateMovieClip.

I am trying to have a MovieClip appear when you click a button, and every time you click that button again, another instance of that Movieclip will appear. Also, each one of the these clips is dragable. I got the dragable part down, I think, but I just cant get multiple copies of the MovieClip to load. Can anyone help me out.

DuplicateMovieClip Help
First of all, I need a good tutorial on the duplicateMovieClip that is comprehensive and easy to understand, second of all, does anyone know if you can make a duplicateMovieClip follow a motion guide?
Thanks in Advance
Jeff

DuplicateMovieClip();
Ok, I was going to put a small temporary hack to my main header flash file by making snowflakes fall. All the snowflakes and their descent is done within the movie clip and all I do is duplicate the movie clip with a random x coordinate and a y coordinate of 80. Here is the code I'm using:

setInterval(Snow, 500);
function Snow(){
SnowFlake.duplicateMovieClip("SnowFlakeM", 4);
SnowFlakeM._x = random(779);
SnowFlakeM._y = 80;
}


My problem is this, since that function is executed every .5 seconds, the last movieclip that it duplicated is removed from the canvas (while it was playing) and replaced with the new movie in the new spot. If looped fast enough, it looks like the screen is being shot with an automatic rifle. What can I do to make this snow fall?

DuplicateMovieClip
Is there something I need to know about using this command not on the root timeline, but in another MC in which I would like to duplicate other MCs?

I don't have my code here to post, but it's pretty similar to this:

http://www.macromedia.com/support/fl...movieclip.html

I have no problem getting this to work on the root timeline, but as soon as I embed this on a frame within another MC which I place on the main timeline, I never see the duplicated MCs.

Thanks for any help.

RH

DuplicateMovieClip Help
I need help creating 2 columns using DuplicateMovieClip
The number of clips will be a dynamic value but there will only be 2 columns. I don't know what I need to do to set the _y properly based of each clip. Here is what I started:

i = 1;
clipAmount = 21;
clipWidth = mc_temp._width+5;
clipHeight = mc_temp._height+10;
for (i = 1; i <= clipAmount; i++) {
duplicateMovieClip(mc_temp, "part" + i, i);
if (i==1) {
this["part" + i]._x = mc_guide._x;
} else {
this["part" + i]._x = mc_guide._x;
this["part" + i]._y = this["part" + (i-1)]._y+clipHeight;
}
}


I need the clips in the columns to start at "part1" so I can eference them later. Thats whay I created a "mc_temp" clip. I'm also attaching my fla.
Thanks guys

DuplicateMovieClip
I have created a movie clip that has buttons on it which need to refer to the main timeline. The clip is duplicated using the duplciateMovieClip function, but now the buttons don't work. Anyone know what is going on here?

Help W/ DuplicateMovieClip
hi everyone;
i am creating a mouse follow, and i am trying to duplicate the movie that follows many times (i did), but i want to decrease the speed of each dulplicate, but i cant access the "var speed" (which i declared inside the follower movie) using the following

space=10;
for(i;i<8;i++){
duplicateMovieClip(folo,"r"+i,i-1);
setProperty("r"+i,_x,folo._x-space);
setProperty("r"+i,_y,folo._y-space);
"r"+i.speed -=1;
space+=5;
}
"r"+i.speed -=1;

should not each duplicate inherit all vars in the parent movie!!!!!!!
please help

DuplicateMovieClip
I've dragged an instance of two movie clips to the stage and I want one to serve as a mask and the other to serve as the masked image. I'd like to duplicate the movie clip, which serves as the Mask, over and over until the masked image is revealed, but I can't seem to figure out the correct ActionScript code. Can anyone out there help? I think I probably need to create a function and then simply call that function, but I'm not sure and frankly even if that's what I should do, I'm not quite sure how I'd go about it. Thanks.

DuplicateMovieClip
hello

I know how to use the duplicateMovieClip command to create a new MC, but does anyone know the syntax I would need to create a new MC and place it inside an existing MC on the stage?

cheers!

Duplicatemovieclip Help
I want the user to specify a number, and then display that many copies of a movie clip.

i can make duplicatemovieclip produce the extra mc's needed, but how do i refer to each one? there could theoretically be an infinate number, and i need to run a loop and perform actions on each mc.

how do i refer to each mc, is it possible to index them, e.g myMC(1).blah..? and therefore use a for-i loop and do myMC(i).blah..?


thanks ,

Andrew

DuplicateMovieClip (f5)
Is it possible at all to give the duplicateMovieClip a target MC in which it has to put the duplicates???

i know you can give it a depth, but I want the duplicates to be put into another MC.

thanks!

DuplicateMovieClip()
Hi,

When I duplicate a movie clip, it always seems to appear *on top* of any layers it should be under. eg. duplicating movieclipA on layer 1 puts the duplicate above anything on layer 2. this means its not possible to have duplicated movie clips affected by masks etc... Is this right? Or am i being really really dumb. hope someone can help....

thanks,

Tim.

DuplicateMovieClip
when using the duplicateMovieClip command inside a movieclip, can I only duplicate clips inside this clip?
Or can I use complete paths to duplicate other clips on the main timeline?

_Is that clear???
Hmmmmm I'm not sure I've worded that the best, hopefuly someone will get me.

Intravenus.

DuplicateMovieClip
please help to fined out the difference between these---

duplicateMovieClip(nine_mc, "nine"+k+"_mc", k);

duplicateMovieClip("nine_mc", "nine"+k+"_mc", k);

What i am finding is- movie clips are not duplicated with the second line of code.

DuplicateMovieClip
Thanks nunomira.
again i am stuck at this point
This code i've written on a movie clip-----

onClipEvent (mouseMove) {
if (hitTest(_root._xmouse, _root._ymouse, false)) {p=_root.r; //r is number obtainer at runtime
// ab is the movie clip depending on the value of r
ab=eval("_root.nine"+p+"_mc");
trace(ab._x); // working fine
// ab movieclip to be duplicated
ab.duplicateMovieClip("_root.ninex_mc",200);
trace(eval(_root.ninex_mc)); // undefined
}
}
at the last line it is not working, can anyone fine the mistake in duplicating movie clip?

DuplicateMovieClip
According to the Actionscript Dictionary, I should use the following code for duplicating movieclips:

(action assigned to a button)
on (release) {
amount = 10;
while (amount>0) {
duplicateMovieClip (_root.flower, "mc"+i, i);
setProperty ("mc"+i, _x, random(275));
setProperty ("mc"+i, _y, random(275));
setProperty ("mc"+i, _alpha, random(275));
setProperty ("mc"+i, _xscale, random(50));
setProperty ("mc"+i, _yscale, random(50));
i++;
amount--;
}
}

However... this doesn't work.

Now if I change the target in the setProperty lines from "mc"+i to "_root.flower", then it does work.
Would make more sense if the setProperty functions were called before duplicating the movie.

Explanations are most welcome.

DuplicateMovieClip
I'm trying to duplicate a Movie Clip when a movie is clicked on a screen.
so i'm also trying to combine 2 events , the following the mouse/cursor and duplicate when the mouse is clicked

This is what i havew so far-

onClipEvent (load) {
Mouse.hide();
startDrag(this, true);
}
on (release) {
amount = 1;
while (amount>0) {
duplicateMovieClip (_root.mark, "mc"+i, i);
setProperty ("mc"+i, _xscale, random(250));
i++;
amount--;
}
}

Its not right, what I'm trying to do is duplicate an movie where the mouxe is clicked.

DuplicateMovieClip {help Please}
hello all,

here is what i am tring to do. i want take the value of an array(value1) and apply that value to a movieClip(square) then duplicate the mc that many times going up on the y axis, like a graph. i can do this but it looks staic,

i was wondering if someone can help with the code to animate the movieclip(square), based on the array value.

thanks, so much,

chuck

DuplicateMovieClip... How?
I'm trying to make a game in Flash MX 2004 Professional, and I need to use 'duplicateMovieClip'. But... how do I use it?

DuplicateMovieClip();
Can someone paste a script that duplicates a movie clip whn the movie loads???

onClipEvent(load) {
this.duplicateMovieClip(box2, 10);
box2._x=10;
box2._y=10;
}


WHats wrong with this one??
Never works! Aaargh!

DuplicateMovieClip
I'm trying to duplicate a MC and have it placed 40 px under the first one. I put this code on the MC i want duplicated but nothing happens. Whats wrong with it?

onClipEvent (load) {
if (this._name == "textbox" && _root.button.count >= _root.button.i){
duplicateMovieClip(this, "textbox" + _root.button.i, _root.button.i);
setProperty("textbox"+ _root.button.i, _y, 40);
_root.button.i++;
}
}

DuplicateMovieClip
Hi, I'm trying to duplicate a movie clip as soon as the timeline starts playing. I have this script so far but its not working:

onClipEvent(enterFrame) {
count=3;
i=1;
while (count<3) {
duplicateMovieClip(_root.ball, "ball"+i,i);
setProperty("ball"+i,_y,25);
}
i++;
count--;
}

Can someone help me?

-G

Duplicatemovieclip
one of the only flash functions that i am having trouble to understand and is a great tool, if somoene could give a detailed explanation on it i would be very greatful and if you could include an example you are a god

DuplicateMovieClip
Hello. I am using duplicateMovieClip to create a wallpaper of sorts. I am trying to get the mc to tile the majority of the screen. What is the most efficient way of writing the positioning for this? You can see below that I am switching the x value once i is greater than 8. I am trying to avoid nesting a lot of if statements.

Does this make sense?




Code:
for (var i = 0; i<16; ++i) {
// create the new clip
var mc = myClip.duplicateMovieClip("myClip"+i, i);
// position the clip
if (i<8) {
mc._x = 40;
mc._y = 40+i*40;
} else {
mc._x = 80;
mc._y = 40+(i-8)*40;
}
// now add an onPress event for the clip
mc.onRelease = function() {
trace(this._name);
trace(this._y);
};
}
Thanks in advance,
1M.

DuplicateMovieClip ( );
say ive got a bacic set up of two movie clips (the first has another movie clip inside of it), ans i want one to have a boutton that tells it to get a movie clip for _root.movieclip1 say it was told to get _root.movieclip1 and duplicate it to _root.movieclip2 in put it in there.

How is it done?

From BOT

DuplicateMovieClip
Hi there,

I am working on the action of duplicateMovieClip...I would like to get duplicated movie clip on entire stage....

It duplicates 200 times on X at the moment. but I also want on Y.

for example:

-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------
-----------------------------------------


Cheers

DuplicateMovieClip
I'm writing a game in which a chopper drops bombs like this:


Code:

if (Key.isDown(Key.ENTER)) {
newBomb = random(100);
_root.fr = newBomb;
duplicateMovieClip("_root.bomb", newBomb, -2);
Y = _root.chopper._y+33;
X = _root.chopper._x+33;
setProperty("_root."+newBomb, _y, Y);
setProperty("_root."+newBomb, _x, X);
tellTarget ("_root."+newBomb) {
gotoAndPlay(2);
}
}
the bomb MC has two frames, second of which has the following code:

Code:
this._y+=20;
the problem is that when i press ENTER Key while one bomb is falling, the falling bomb disapears and new one starts to fall, i want to make several bombs fall at the same time, how do i do that?

DuplicateMovieClip
I am using duplicateMovieclip command to duplicate a square.

Now I just want to select a particular duplicated movieclip and make some changes to it. But I can not trap its name.

The name of the main movieclip is "sq" and for the new name I have used "n" and whenever I click on a button "n" becomes n+1;

Here is the code that I am using:

on (release) {
_global.n=1;
duplicateMovieClip(_root.sq, n, n+1);
n=n+1;
_root.sq._x=100;

}

Any help would be appreciated.

Thanks in advance

DuplicateMovieClip
I am using duplicateMovieclip command to duplicate a square.

Now I just want to select a particular duplicated movieclip and make some changes to it. But I can not trap its name.

The name of the main movieclip is "sq" and for the new name I have used "n" and whenever I click on a button "n" becomes n+1;

Here is the code that I am using:

on (release) {
_global.n=1;
duplicateMovieClip(_root.sq, n, n+1);
n=n+1;
_root.sq._x=100;

}

Any help would be appreciated.

Thanks in advance

DuplicateMovieClip
I am using duplicateMovieclip command to duplicate a square.

Now I just want to select a particular duplicated movieclip and make some changes to it. But I can not trap its name.

The name of the main movieclip is "sq" and for the new name I have used "n" and whenever I click on a button "n" becomes n+1;

Here is the code that I am using:

on (release) {
_global.n=1;
duplicateMovieClip(_root.sq, n, n+1);
n=n+1;
_root.sq._x=100;

}

I am unable to trap the new name for the movieclip so that I could change that particular movie clip. Eg. increase or decrease size of the movieclip

Any help would be appreciated.

Thanks in advance

DuplicateMovieclip
I am doing a tutorial on duplicating movie clips, and it works fine, but when I add another movie clip it gets rid of the old one. Can anyone help me?

Copyright © 2005-08 www.BigResource.com, All rights reserved