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




Resizing And Duplicating Movie Clips



Hi, I'm trying to find info on how to have a thumbnail version of a clip and then be able to drag that one to a place on the screen and it grows to 100% it's size. I also want the original to stay where it was so it can be done multiple times.

Thanks in advance



FlashKit > Flash Help > Flash ActionScript
Posted on: 04-20-2005, 08:00 PM


View Complete Forum Thread with Replies

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

Empty Movie Clips And Duplicating Clips
I've been trying to reproduce an animation effect I've seen on the Armani website, but I'm stuck trying to duplicate an empty movie clip with image loaded into it. The duplicates exist and I can move them, but they are invisible. Since the duplicates reside on depths above the intitial clip I'm confused about why they are invisible. The duplicates are scripted to follow behind the initial clip - each offset by 30 pixels (though I don't have that working perfectly).

I'm attaching a simplified version of my file to isolate just the duplication troubles. Thanks for the help!

Duplicating Movie Clips
http://www.lancetfluke.com/New.html

Quick summary:
I need to know how to make infinite number of duplicates of a movie.
I want the duplicate to be made where the user clicks, and have that one play. The others should remain as they look on the last frame of the movie clip, which has a "stop ();" on the last frame.
I want the duplicate to be made when the user presses their mouse button, not when they release.

Details:
I think what I'm trying to make here is fairly obvious, in the area where the cursor turns into a crosshair I'd like the user to click and have a bullet hole appear (as a movie clip that plays, you'll see this if you check out the URL above). Obviously the art is horrible I'm doing this solely as a learning process before I apply it to a real project.

A few problems I'm having with this...

I want to be able to make an infinite number of duplicates of the movie clip (bullet). I can only get it to make one, then it moves the other clip around. Here's the script I'm using, as the button script. The button is the lighter grey area where the crosshair appears.

on (release) {
duplicateMovieClip (bullet, bullet2, 2);
setProperty (bullet, _x, _xmouse);
setProperty (bullet, _y, _ymouse);}

I'm guessing something needs to be done with an incrementing variable but do not know how to implement this. I realize this script is totally wrong but it is the only way I could make a flash animation that has no script errors and gives you an idea of what I want to achieve. I would also like the movie clip to be duplicated when they click down, not on release, but I don't know the command for this in Flash 5.

The duplicate is made where the user clicks but does not play, rather the previous bullet clip plays. I want the newly created duplicate movie clip to play, as the new bullet-hole. This obviously ties in to the above scripting but I don't know how.


If it matters, here's the script I'm using to show/hide the cursor...

if (_xmouse>20&&_xmouse<195&&_ymouse>31&&_ymouse<369) {
Mouse.hide();
setProperty (cursor, _alpha, "100");
setProperty (cursor, _y, _ymouse);
setProperty (cursor, _x, _xmouse);}

else {
(Mouse.show());
setProperty (cursor, _alpha, "0");}

Thanks for any help on any parts of my problem!

Help In Duplicating Movie Clips
hi guys i have a problem

lets say i have 2 movie clips movie clip 1 = $ and movie clip 2 = ,

ok now i duplicate the 2 movie clips 10 times

how to i make it dulpicate 5 times on 1 line and after 5 times the rest will appear on hte next line
something like this

$,$,$,$,$, (5 times here)
$,$,$,$,$, (continue 5 times here)

can this be done??
pls help me thanks a million in advance.

Duplicating Movie Clips
does any one know of a tutorial that demosrates duplicating more then one movie clip in the same movie. possibly by duplicating one on frame 1 and one on frame 2 and loping the frames.

Duplicating Movie Clips
Hello, please forgive me if my question is very basic.

I need to know how to duplicate a movie clip so that it will duplicate again. EG. a line would form a flower eventually.

I have a movieclip called line, which I need actions so that every time the playhead enters the frame with an action in it, it will duplicate the movieclip line 3 degrees tilted of an angle of the previous movie clip.

Unsuccesful tries:

for(i=0;i<120;i++) {
line.duplicateMovieClip("line"+i,i);
root["line"+i].rotation = i*3;
}
//========================end======================= =

//this was for Flash 4, I have 5

Set Variable: "n" = n+3
If (n<360)
Duplicate Movie Clip("/line","line"&n, n)
Set Property("/line"&n, Rotation) = GetProperty("line", rotation)+n
Go to and Play(1)
End if
//==================================end============= ==

Example:
http://www.praystation.com/
See the pandora's box projects

If any one can help, I would really appreciate it

Thank You!!!

Duplicating Movie Clips
Ok here's the question, there should be an easy answer.

I'm duplicating movie clips by clicking on the original movie clip. But I want to make the duplicated clips draggable. But I'm not sure where to put the code as I don't want the orginal clip to be draggable.

Any ideas? Thanks.

Duplicating Movie Clips
gday guys

here's my question basically what i want is for random movie clip to appear after i click a button.

i have assigned this code to the button:


Code:
on (release) {
amount = 1;
while (amount>0) {
duplicateMovieClip(_root.movieclip, "mc"+i, i);
setProperty("mc"+i, _x, random(430)+60);
setProperty("mc"+i, _y, random(220)+90);
i++;
amount--;
}
}


ok, now here's my problem, it concerns nesting order. when these new movie clips are created they move on top of everything. i want all of these new movie clips to sit behind other movie clips when they are created. any ideas?

thanks

steve

Help With Duplicating Movie Clips
Alright... here's the situation:

for (j=1; j<12; j++)
{
row1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
populateBricks(j);
}
function populateBricks(k)
for (i=1; i<12; i++)
{
if (row1[i] == 1) {
lblueBrick.duplicateMovieClip("lblueBrick"+i, i+100,1);
lblueBrick._x = 45+i*50;
lblueBrick._y = 35+k*30;
}
}

What I'm basically trying to do is have row1 be an array and to fill up the screen with the movie clip lblueBrick and using the function populateBricks() to do it. I can't get it to work though. It fills the bottom row and the furthest to right on the row above it, but all the rest of the rows are empty!

Someone must know what's wrong and how to fix it.

Duplicating Movie Clips
In this fla I have attached, you can pick up the different parts of the skeleton and rearrage it and when you press the dance button the skeleton dances. When you press the duplicate button it duplicates the movie clip but it automatically starts to dance. I want to be able to duplicate the movie clip so more skeletons appear and so you can rearrange the bones, then when you press the dance button all the movie clips dance. Does anyone know if you can do this?

Duplicating Movie Clips
i want to duplicate 5 boxes in a row and the sixth box should come in the next row. how do i do that??

Duplicating Movie Clips
In my portfolio page I'm making the interface draggable windows. I'm going to need around 40 seperate windows with different content I have an MC that is draggle closable and minimizeable so I'd like to dynamically duplicate it but then have a specific extrernal .swf loaded in the window...

Thanks everyone

USB King

Duplicating Movie Clips
Hi,

I have a .fla that contains a functional record player (turntable) that you can drag a record to and play mp3 files from. The player consists of groups of movie clips.

I've added a DJ mixer with a volume fader that controls the volume of the mp3 when playing (and it actually works!). Now I want to add a second player that is exactly like the first one. I know that I can't just copy/paste the first player because all of the functions and instances in the pasted second player would control the first player's actions. Right?

Finally the question: What is the best way to duplicate a group of movie clips to have them function on their own? Do I have to duplicate each object and change every function, instance and variable name in the Actionscript layers and button actions?

Maybe there's a better way......?

Duplicating Movie Clips (F8)/(F9)
The main issue is that when I am duplicating these movieclips (from instances I have off the viewable stage), it is duplicating all of them at once. I want to be able to have multiple duplicates up on stage but not for it to duplicate 100 all at once.

here is my code that I know, I way over did it and I am sure there is a way to make it 10 times shorter but I don't have the time. Anyone, have any ideas...


PHP Code:



btn1_dup = function () {
for (az=0; az<100; az++) {
duplicateMovieClip("a1","a"+az,this.getNextHighestDepth());
setProperty("a"+az, _x, controlPoint_mc._x);
setProperty("a"+az, _y, controlPoint_mc._y);
}
}

btn2_dup = function () {
for (bz=0; bz<100; bz++) {    
duplicateMovieClip("b1","b"+bz,this.getNextHighestDepth());
setProperty("b"+bz, _x, controlPoint_mc._x);
setProperty("b"+bz, _y, controlPoint_mc._y);
}
}

btn3_dup = function () {
for (cz=0; cz<100; cz++) {
duplicateMovieClip("c1","c"+cz,this.getNextHighestDepth());
setProperty("c"+cz, _x, controlPoint_mc._x);
setProperty("c"+cz, _y, controlPoint_mc._y);
}
}

btn4_dup = function () {
for (dz=0; dz<100; dz++) {
duplicateMovieClip("d1","d"+dz,this.getNextHighestDepth());
setProperty("d"+dz, _x, controlPoint_mc._x);
setProperty("d"+dz, _y, controlPoint_mc._y);
}
}

btn5_dup = function () {
for (ez=0; ez<100; ez++) {
duplicateMovieClip("e1","e"+ez,this.getNextHighestDepth());
setProperty("e"+ez, _x, controlPoint_mc._x);
setProperty("e"+ez, _y, controlPoint_mc._y);
}
}

btn6_dup = function () {
for (fz=0; fz<100; fz++) {
duplicateMovieClip("f1","f"+fz,this.getNextHighestDepth());
setProperty("f"+fz, _x, controlPoint_mc._x);
setProperty("f"+fz, _y, controlPoint_mc._y);
}
}

btn7_dup = function () {
for (fz=0; fz<100; fz++) {
duplicateMovieClip("g1","g"+fz,this.getNextHighestDepth());
setProperty("g"+fz, _x, controlPoint_mc._x);
setProperty("g"+fz, _y, controlPoint_mc._y);
}
}

btn8_dup = function () {
for (hz=0; hz<100; hz++) {
duplicateMovieClip("h1","h"+hz,this.getNextHighestDepth());
setProperty("h"+hz, _x, controlPoint_mc._x);
setProperty("h"+hz, _y, controlPoint_mc._y);
}
}

btn9_dup = function () {
for (iz=0; iz<100; iz++) {
duplicateMovieClip("i1","i"+iz,this.getNextHighestDepth());
setProperty("i"+iz, _x, controlPoint_mc._x);
setProperty("i"+iz, _y, controlPoint_mc._y);
}
}

btn10_dup = function () {
for (jz=0; jz<100; jz++) {
duplicateMovieClip("j1","j"+jz,this.getNextHighestDepth());
setProperty("j"+jz, _x, controlPoint_mc._x);
setProperty("j"+jz, _y, controlPoint_mc._y);
}
}

btn11_dup = function () {
for (kz=0; kz<100; kz++) {
duplicateMovieClip("k1","k"+kz,this.getNextHighestDepth());
setProperty("k"+kz, _x, controlPoint_mc._x);
setProperty("k"+kz, _y, controlPoint_mc._y);
}
}


liner.all_btns.all_btns_inside.btn1.onRelease=function () {
btn1_dup();
}    

liner.all_btns.all_btns_inside.btn2.onRelease=function () {
btn2_dup();
}

liner.all_btns.all_btns_inside.btn3.onRelease=function () {
btn3_dup();
}

liner.all_btns.all_btns_inside.btn4.onRelease=function () {
btn4_dup();
}

liner.all_btns.all_btns_inside.btn5.onRelease=function () {
btn5_dup();
}

liner.all_btns.all_btns_inside.btn6.onRelease=function () {
btn6_dup();
}

liner.all_btns.all_btns_inside.btn7.onRelease=function () {
btn7_dup();
}

liner.all_btns.all_btns_inside.btn8.onRelease=function () {
btn8_dup();
}

liner.all_btns.all_btns_inside.btn9.onRelease=function () {
btn9_dup();
}

liner.all_btns.all_btns_inside.btn10.onRelease=function () {
btn10_dup();
}

liner.all_btns.all_btns_inside.btn11.onRelease=function () {
btn11_dup();
}

Duplicating Movie Clips
In my portfolio page I'm making the interface draggable windows. I'm going to need around 40 seperate windows with different content I have an MC that is draggle closable and minimizeable so I'd like to dynamically duplicate it but then have a specific extrernal .swf loaded in the window...

Thanks everyone

USB King

Duplicating Movie Clips
Hey guys.
I was wondering is there a way to duplicate a movie clip and edit a text field in the duplicate movie clip without editing whats in the text field in the original movie clip even if that text field in the mc is animated with a guided motion tween?

i havnt started workin on the animation or nething yet cause i need to do it 36times with each letter of the alphabet but i was wondering if i can do it by just making one mc with the text field animated how i want and have it duplicated and edit the duplicate with out changing nething on the original to save time?

thanks in advanced

Duplicating Movie Clips
Hi there,

Can anyone help me out with duplicating a movie clip that is on the stage?

The movieclip in question is not one that refers to a class in the Library. It is the target.content cast as MovieClip that is Loaded by the Loader class.

Is it possible to duplicate such movieclips? Or do they have to be in the library to use them in such a manner as

var temp:MovieClip = new LibraryItem() // item in library with class of LibraryItem that extends MovieClip

Any help would be great.

From what I understand, it shouldn't matter, once I have a MovieClip I should be able to copy it into a new MovieClip. Well thats what I gather anyway, please tell me if I am wrong.

Thanks,

Nathan

Duplicating Movie Clips
As far as I know you duplicate movie clip like this.

ActionScript Code:
var instance2=new particle();
And when you make the original movie you export it for AS with className "particle".

Now I was wondering how to create, say 5 movie clips using a loop, and give each one a different name.

In AS2.0 the code would look like this.

ActionScript Code:
duplicateMovieClip(particle,"particle" add counter,counter)
But if i write

ActionScript Code:
var "particle"+counter=new particle()
in AS3.0 it gives an error.

Duplicating Movie Clips As3
I have done a lot of reading on this subject and of course support is weak. i have tried oh so many things and the closest i have come is the class by senocular.

This works as a class perfectly, however if you try and duplicate a movie clip that has nested children they do not copy accross just the parent. let me explain


Code:
import duplicateDisplayObject;

//i create a holder for my duplicateed movie clip
var mHolder:MovieClip = new MovieClip();
addChild(mHolder);

// i add lots of different movies to it
var m1 = new mcBg1();
mHolder.addChild(m);
var m2 = new mcBg2();
mHolder.addChild(m);
var m3 = new mcBg3();
mHolder.addChild(m);

// use the class here to copy 'mHolder' the parent of the movie clip 'm'
var newInstance:DisplayObject=duplicateDisplayObject(mHolder,true);
newInstance.x=200;// shift to see duplicate

trace(newInstance.width)
So the result of this i guess is mHolder been duplicated and not the movie/movies attached. does anyone have a theory on this?

cheers guys

Help On Duplicating Movie Clips
hi, i am weak in actionscript, wanna ask u guys how do i duplicate just one movie clip on each click of the button, and the _x of each clip will increase accordingly?? need help on the .fla attached below.. thx...

Duplicating Movie Clips Help
I can duplicate a movie clip fine. The movie clip i duplicate ill call "A". The duplicate i have ill call "A1". I have a seperate movie clip called "B" on a higher layer. The wierd part it "A1" will appear over "B" even though "B" is on a higher layer. I need to know how to keep "A1" under "B".

PLEASE and THANK YOU

Duplicating Movie Clips
I've made a movie clip button for navigation. The buttons navigate between scenes, of which I'll have about 12. This means I need previous and next buttons for each scene. So I duped the original MC button, and changed some things on the duped button.

The problem is, the original also takes the changes. What's the point of duplicating something if they remain the same thing? How can I make disassociated copies? Or is there some other way to make multiple buttons that look the same but go to different places...

Duplicating Movie Clips
I was wondering how do you duplicate movieclips in a certain location in flash
can anyone help me with the coding and it would be nice if you could explain it to me! :D

Duplicating Movie Clips?
HI,
I'm working on a few projects, mainly a program that organizes projects, and I was wondering how you can reate more movie clips depending on how many you need.
For example:
A while ago I created a calendar with a flagging system. If you needed a flag, then you would press a button and the flag would appear, and you can drag this around. However, since the instance name changes, I can not drag the second object. My first guess would be to use something resembling Dim statements form True Basi, which went something like this.

Dim sum(1 to 3)
For x=1 to 3
Input Avg(x)
Next x
Let y=sum(1)+sum(2)+sum(3)
Print y

Is there anything like this in Action script or any other way to do what i wanted?

Thank You!

Duplicating Movie Clips
Hello,

I this is probably a very simple thing to do but I cant find anything which seems to a duplicate movie clip and maybe this function has been completely removed and not recreated at all within the new AS3 where it was available in AS2.

I am wondering if someone can help me with this.

I have attached a snippet of my code below which defines what I am attempting, any help would be appreciated.

Basically all I want to do is duplicate a movieclip in a for loop and have them placed side by side with each other.

Here is my code:

for (i=0; i<10; i++)
{
addChild (_brick);
_brick.x = brick.width * i;
}

Many thanks in advance

Lee

Duplicating Movie Clips
Hello, I want to ask if someone can help me whit the isssue duplicating movie clips in some defineid stage area (x,y). I want to have only one mc whit a dynamic txt fild inside, what i want to do is multipicate this mc in the stage, in sprecifeid coordenates, and the dyn txt filed must load number 1,2,3....

thanks in advance


//thebull

Duplicating Movie Clips
i have a little problem with duplicating movie clips. I am a duplicate movie clip newbie, so i duno very much..anywayz...i create a movie clip of a circle just sitting there in the first frame with no other tween.

but then i add the duplication clip action, in then circle movie clip..now when i play, it does duplicate the movie clip, but it duplicates it and when it duplicates it again, it removes the movie clip it created..so like i got a bunch of circles appearing all over the place, but not staying. my code kinda looks like this

amount = 10;
while (amount<10)
{
duplicateMovieClip(_root.circle, "circle" + amount, amount);
amount++;
}


yeaaah...any help?

Duplicating Movie Clips
ok
i have a problem with duplicating movie clips
i created a simple animation of ONE firework going up and then exploding.
now

i duplicated that movie clip ten times with a do-while loop. i placed the do-while loop AS in frame 1. and i wrote some action script on the actual firework movie clip, that will randomly scale and place the firework clip randomly along the x axis.

when i test it. 10 movie clips of the firework pop up and do its animation. thats all good...but how do i get it to do continuous duplication. so like right after it does its first 10. it will do anohter 10..and be random all over again..can i make it so i goes up one at a time?

if you need my fla file..just ask for it. i'll attach it in the next reply

Duplicating Movie Clips
Questions,

How do you duplicate a movie clip (say if you where using it as a template to make several of the same type of MC's) with out each one taking on the characteristics of the one you duplicated. WHOO. I hope that made sense.

I am using a MC to display my portfolio and have many of these to create. I would like to duplicate one and be able to switch certain elements. But everytime I do and make changes to the new MC, it changes the old one as well.

Is this possible.

Thank you in advance

www.anamorphicmedia.com

Duplicating Movie Clips
i want to duplicate a movieclip (a box) so that they appear towards.

like this
.
.
.
.
.

starting from top down...
and then when it gets to the bottom. it starts up at the top again but to the right..

so it forms like this
..
..
..
..
..

can anyone helpme? Actionscript please..no motion tweening.

Help On Duplicating Movie Clips
hi, i am weak in actionscript, wanna ask u guys how do i duplicate just one movie clip on each click of the button, and the _x of each clip will increase accordingly?? need help on the .fla attached below.. thx...

Duplicating Movie Clips
Hey guys.
I was wondering is there a way to duplicate a movie clip and edit a text field in the duplicate movie clip without editing whats in the text field in the original movie clip even if that text field in the mc is animated with a guided motion tween?

i havnt started workin on the animation or nething yet cause i need to do it 36times with each letter of the alphabet but i was wondering if i can do it by just making one mc with the text field animated how i want and have it duplicated and edit the duplicate with out changing nething on the original to save time?

thanks in advanced

Help With Duplicating Movie Clips
Does anyone know of any good examples or tutorials that explain how to do a loop which will duplicate a movie clip and repeat it based on the height and width of an area?

The exact thing I am looking to do is what they do with the thumbnails on:
http://www.thefwa.com/


Thanks in advance,
Matt

Duplicating Movie Clips
I imagine this isn't too difficult, but I'm new to flash and can't figure it out. I want to make a movie clip that can be duplicated by dragging and dropping it somewhere else on the stage.

So far I can drag around my MC but the duplication isn't working properly.

I have this in my frame:

numBox = 3;
for (i=2; i<=numBox; i++) {
box.duplicateMovieClip("box"+i, i+100);
visible = false("box");
}


And this on my MC:

on (press) {
startDrag(this);
i = i+1;
duplicateMovieClip(_root.box, "box"+i, i);
}
on (release) {
stopDrag();
}


Any advice would be helpful.

F8 Duplicating Movie Clips
Hi,

I've built a tsunami menu and I've finally got the effect working nicely however I've got 8 external jpegs which make up the content and I'd like the movie to loop through the 8 images until the user clicks on one of the menu items (in which case the movie would jump to which ever scene was selected by the user). At the moment the duplicated menu items scale big when selected however I can't get it to scale big without user interaction as the jpeg sequence loops. Does anyone have any suggestions?!

Also, the other difficulty I'm having is that each time the movie loops it seems to duplicate the menu items again. Can I prevent this from happening?

I'll attach the source file for you to take a look at. I'd be so grateful fo any help on this!

Thanks in advance

Duplicating Movie Clips
i have a little problem with duplicating movie clips. I am a duplicate movie clip newbie, so i duno very much..anywayz...i create a movie clip of a circle just sitting there in the first frame with no other tween.

but then i add the duplication clip action, in then circle movie clip..now when i play, it does duplicate the movie clip, but it duplicates it and when it duplicates it again, it removes the movie clip it created..so like i got a bunch of circles appearing all over the place, but not staying. my code kinda looks like this

amount = 10;
while (amount<10)
{
duplicateMovieClip(_root.circle, "circle" + amount, amount);
amount++;
}


yeaaah...any help?

Duplicating Movie Clips
ok
i have a problem with duplicating movie clips
i created a simple animation of ONE firework going up and then exploding.
now

i duplicated that movie clip ten times with a do-while loop. i placed the do-while loop AS in frame 1. and i wrote some action script on the actual firework movie clip, that will randomly scale and place the firework clip randomly along the x axis.

when i test it. 10 movie clips of the firework pop up and do its animation. thats all good...but how do i get it to do continuous duplication. so like right after it does its first 10. it will do anohter 10..and be random all over again..can i make it so i goes up one at a time?

if you need my fla file..just ask for it. i'll attach it in the next reply

Duplicating Movie Clips
Questions,

How do you duplicate a movie clip (say if you where using it as a template to make several of the same type of MC's) with out each one taking on the characteristics of the one you duplicated. WHOO. I hope that made sense.

I am using a MC to display my portfolio and have many of these to create. I would like to duplicate one and be able to switch certain elements. But everytime I do and make changes to the new MC, it changes the old one as well.

Is this possible.

Thank you in advance

www.anamorphicmedia.com

Duplicating Movie Clips
Is it possible to duplicate a movie clip within a movie clip in the same loop?

Lets say I have 2 MCs, Inside and Outside.

I have the Variable

NumOutside = 3 this is the number of times the outside MC will be duplicated

And the Array

NumInside[1] = 2 this is the number of times that the Inside MC will be duplicated within Outside1
NumInside[2] = 1 this is the number of times that the Inside MC will be duplicated within Outside2
NumInside[3] = 3 this is the number of times that the Inside MC will be duplicated within Outside3

Is there any way in my for command to target
_root.Outside1 when I = 1 and duplicate Inside 2 times
_root.Outside2 when I = 2 and duplicate Inside 1 time
_root.Outside3 when I = 3 and duplicate Inside 3 times

I've tried the following code but have no way to reference the duplicated versions of Outside:


Code:
for (i=1;i!==NumOutside;i++){
_root.Outside.duplicateMovieClip("Outside"+i,i);
setProperty("_root.Outside"+i,_y,i*30);
for (j=1;j!==NumInside[i];j++){
/* need something like _root.Outside+i+.Inside.duplicateMovieClip("Inside"+j,j); */
}

Duplicating Movie Clips
i want to duplicate a movieclip (a box) so that they appear towards.

like this
.
.
.
.
.

starting from top down...
and then when it gets to the bottom. it starts up at the top again but to the right..

so it forms like this
..
..
..
..
..

can anyone helpme? Actionscript please..no motion tweening.

Duplicating Movie Clips
Umm, so, I'm creating a shooting gallery type of game. So I need bottles to scroll across the screen like so many pixels apart from each other. I know how to use the duplicateclip and resetclip functions, but how do I get it so that the next duplicate appear precisely so many pixels right from the first?

Duplicating Movie Clips
Hello all. I have a question. Is there a way to copy and paste a movie clip into the same scene, and then modify it? I know that just copying and pasting will not do it, because I am copying all the frames/action scripts/etc.., so that whenever I change something in the copied clip, it changes the original. Is there a way to duplicate it, then have it to work independently?

Thanks,
Spice1


Duplicating Movie Clips
I'm duplicating movie clips and am running into some trouble with the first duplicate not offsetting itself away from the original movie clip.

Here's the code

if (amount>0) {
duplicateMovieClip(menuItemMovie, "menuItemMovie"+i, i);
var boxLoc = this["menuItemMovie"+(i-1)]._y;
var boxHeight = this["menuItemMovie"+(i-1)]._height;
this["menuItemMovie"+i]._y = boxLoc+boxHeight*2;
i++;
amount--;
} else {
gotoAndStop("done");
}


What am I doing wrong? How do I get the first duplicated clip to offset away from the original?

Duplicating Movie Clips Help
Hi,

I'm having some trouble figuring out how to use the duplicate movie clip command properly. I have a 6 frame movie with 6 corresponding buttons each of which takes you to its corresponding frame-ex-button 1 gotoAndPlay(1)--button 2-gotoAndPlay(2),etc.

I am trying to dynamically set up grids for each button by duplicating a movie clip for each frame. The problem Im experiencing is that if one grid is smaller than the next, upon returning to the smaller grid-elements of the larger grid are still on the stage, due to depths. In my particular movie all the grids are the same size except for the grid on frame one, which is smaller. Switching between grids 2-6 works fine as the new clips are put in the old depths, but since grid 1 is smaller, the other grids remain upon returning to it. How do I get rid of all the old grids or clear their depths? Putting the clips in frame one on a higher depth(getNextHighestDepth)works to a degree, but the other grids still remain behind it and the first field is missing.

Here is the code for generating the small grid:-frame1




ActionScript Code:
var gn:Number;
gn = 1;
for (c=1; c<6; c++) {
    for (i=1; i<6; i++) {
        px = 190.2*i;
        py = 40*c;
        _root.calgridmov.duplicateMovieClip("calgridmov"+gn, gn);
        _root["calgridmov"+gn]._x = px-95.1;
        _root["calgridmov"+gn]._y = py+230;
        _root["calgridmov"+gn].calgrid.background = true;
        _root["calgridmov"+gn].calgrid.backgroundColor = 0xFFFFFF;
        gn = gn+1;
    }
}
stop();



for the large grids:frames2-6




ActionScript Code:
var gn:Number;
gn = 1;
for (c=1; c<18; c++) {
    for (i=1; i<10; i++) {
        px = 111*i;
        py = 35*c;
        _root.gridfirstmov.duplicateMovieClip("gridfirstmov"+gn, gn);
        _root["gridfirstmov"+gn]._x = px-95.1;
        _root["gridfirstmov"+gn]._y = py+230;
        _root["gridfirstmov"+gn].gridfirst.background=true;
        _root["gridfirstmov"+gn].gridfirst.backgroundColor = 0x006699;
 
        gn = gn+1;
    }
}
stop();



Also, I was wondering if there was a way to not have to regenerate the duplicated clips everytime a new button is pressed? (as it is because Im substituting one grid for another depthwise it seems necessary), but these movieclips are all going to be filled with editable text from an xml file, so Im concerned about slow down--Or does it matter?

Im attaching a mockup up I made as believe it or not this is a really useful project Im working on but it requires an additional component that doesnt ship with Flash.


http://www.mpendragon.com/sample.fla

Thanks,
Yvette

Duplicating Movie Clips
I'm trying to duplicate some bullets so the new instances slide down to form a list but for some reason I can't get the newly duplicated instances to move.
Here's my code:

Code:
for (i=0; i<5; i++) {
bullet.duplicateMovieClip("bullet"+i, i);
this["bullet"+i].onEnterFrame = function() {
with (this["bullet"+i]) {
_y += ((100+10*i)-_y)*0.4;
}
};
}
PS there's already an instance on the stage of the first bullet. It has an instance name of "bullet"

The error I get is that "a with operation failed because the specified object does not exist"

Any help would be greatly appreciated.

Duplicating Two Movie Clips At The Same Time
Hi,
It is probably a very basic question, but I don't know how to duplicate two MC with one mouse event.
I've tried a code like this, but it doesn't seem to work:
(It only duplicates "MC", but not "otherMC".)

on (release) {

duplicateMovieClip ("MC", "MC"+ counter, counter);
setProperty ("MC"+ counter, _y, counter*20);
setProperty ("MC"+ counter, _X, + 485);

duplicateMovieClip ("otherMC", "otherMC"+ counter, counter);
setProperty ("otherMC"+ counter, _y, counter*20);
setProperty ("otherMC"+ counter, _X, + 475);

counter ++;
}

Thanx in advance.
Zoo_Mann

Duplicating Movie Clips Problem
I'm creating a side-scrolling game with a bunch of movie clips on the main timeline such as:

laser
torpedo
enemyOne
enemyTwo
health
healthMega
etc..

When I duplicate a clip, I'm using a script similar to this:
duplicateMovieClip("laser","laser" add e, e);
setProperty(laser add e, _x, 500);
setProperty(laser add e, _y, random(150)+20);
e = Number(e)+1;
resetLevel(); // a function that resets the 'e' value to zero once it hits 30, thus making 30 the max onscreen clip number

So, each new clip is named laser1, laser2, laser3, etc. This is what I do for each item.

So say I shoot laser32 at enemyOne9. Of course, I want to detect a collision between them.

As of now, I have a script on the enemyOne clip as follows:
onClipEvent (enterFrame) {
for (i = 0; i < 30; i++){
if (this.hitTest( _root.laser add i)){
hit_x = getProperty(_root.laser add i, _x);
hit_y = getProperty(_root.laser add i, _y);
this._x = this._x + 20; // bounces enemy back a bit
setProperty(_root.laser add i, _x, 500);
_root.smallExplosion(hit_x,hit_y); // runs explosion clip
}
}

So, the movie clip is continually searching for a collision between the laser clip and the enemyOne clip, going through 30 numbers all the time to find the collision if it exists.

This is waaaaaayy too memory intensive, and there's gotta be another way to find the collision between these clips (which are constantly taking on new names in increments of 1).

I'm fairly new at programming in general, so most of this is just out of my head. There may be another way I just don't know of...

Duplicating Dynamic Movie Clips
Does anyone know how to duplicate a dynamic movie clip.

And By dynamic i mean a Clip in which other Clips have been added to it, via attachMovie. Like this

Movie1.attachMovie("Animation",Movie2,1);

If you then try:

duplicateMovieClip(Movie1,Movie3,2);

It does Duplicate Movie1 but it will not have Movie2 inside of it.

At least not from what i've tried.

The only way so far i know of doing it would be to reAttach Movie2 to the Movie3 clip. But with the work i'm doing each movie clip is very complex with lots of clips inside.

Anyone have a solution to this problem?

Duplicating Movie Clips Within A Mask PLEASE HELP
I have an mask over an area on my stage 100x300 and in that area I have a movie clip the same size (mc1). I need to be able to duplicate mc1 and make a new instance of it (mc2) and place it under that same mask.

From there I need to check the height of those two movie clips in order to assess if a scroll bar is needed. Should those two MC's be placed in another movie clip so they can then scroll within the masked area? I hope this makes sense. I wasn't really sure how to word it. Let me know if you have questions and I'll try to explain better.

The idea is that I will have just the one MC sometimes to display within the masked area and other times there could be 6 MC's that need to scroll in that same masked area. So sometimes there will be a scroll bar and other times there won't. make sense?

what would be the be the best way to all this?

Thanks so much!

SwapDepths Duplicating Movie Clips ?
Hello everyone,
I'm in the process of creating a menu system where the buttons are movieclips containing a image. This movieClip expans when rollled over. This is done by a button inside the movie clip calling a function The problem l'm having is that for some reason the swapDepth action is duplicating certain movieClips. Leaving them on stage

the actionScript that is on the button is:

on(rollOver, dragOver){
_root.submenu.gotoAndPlay("branch")
_root.linepos = 420;
_root.b6.scale = 1;
for (i=1; i<=_root.numButtons; i++) {
_root["b"+i].swapDepths(1);
}
_root.b6.swapDepths(2);

}

the code is identical on all buttons but for some reason it seems to happen on two buttons in particular. This problem doesn't happen when l remove the swapDepth action. Unfortunately it is necessary.

has anyone else encountered this problem?

Any help is appreciated
Thanks guys and girls

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