# \[FLASH 8\]duplicate Movieclip

**URL:** <https://forum.kirupa.com/t/flash-8-duplicate-movieclip/183502>\
**Category:** flash\
**Created:** [March 27, 2006, 5:37pm UTC](https://forum.kirupa.com/t/flash-8-duplicate-movieclip/183502 "2006-03-27T17:37:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MyDNA](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@MyDNA](https://forum.kirupa.com/u/MyDNA)\
**Post date:** [March 27, 2006, 5:37pm UTC](https://forum.kirupa.com/t/flash-8-duplicate-movieclip/183502/1 "2006-03-27T17:37:27Z")

</div>

i’ve got a script of a newspage with php and mySQL  
(within flash ofcourse)  
This script got 1 dynamic text field.  
Now i like to create it different. Every title and body message must be together in 1 MC.

So i think the best is to use the duplicateMovieClip statement.

I found this code in a book of mine and changed it a bit for where i know. But I still have two problems.

FIrst of all:  
All the movieclips will be placed at \_x. 0 and \_y. 0  
And for every record (ID) i need to automaticly create a new MC.  
I got this code for static adding Mc’s but it must be dynamicly loaded and the second mc must come after the first one.

i got this actionscript so far:

[AS]  
depth = 0;  
for (copy = 0; copy \< 10; copy++)  
{  
duplicateMovieClip (\_root.loadNieuws.nieuwsItem, “nieuws” + copy, depth);  
\_root.loadNieuws[“nieuws” + copy].\_x = 0;  
\_root.loadNieuws[“nieuws” + copy].\_y = “nieuws” + 5;  
depth++;  
}  
[/AS]

this code ofcourse creates 10 Movieclips with the instancename “nieuws0” to “nieuws9”

do i need to place it in an onClipEvent() ?  
for now i placed it in the first frame.

The original code i found got a random placement. and ofcourse i changed that.  
If someone can help me out, i would be gratefull.  
And ofcourse when someone needs more information: i’ll be there.

Already thanks for helping  
kind regards Jos

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 27, 2006, 5:48pm UTC](https://forum.kirupa.com/t/flash-8-duplicate-movieclip/183502/2 "2006-03-27T17:48:50Z")

</div>

```auto
for (copy = 0; copy < 10; copy++){
    var news:MovieClip = duplicateMovieClip (_root.loadNieuws.nieuwsItem, "nieuws" + copy, copy);
    news._x = 0;
    news._y = 20*copy; // <-- what were you trying to do there? Try something like what i just put there.
}

```

---

<div class="post-metadata">

**Author:** ![MyDNA](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@MyDNA](https://forum.kirupa.com/u/MyDNA)\
**Post date:** [March 27, 2006, 6:16pm UTC](https://forum.kirupa.com/t/flash-8-duplicate-movieclip/183502/3 "2006-03-27T18:16:34Z")

</div>

```auto
for (copy = 0; copy < 10; copy++){
    var news:MovieClip = duplicateMovieClip (_root.loadNieuws.nieuwsItem, "nieuws" + copy, copy);
    news._x = 0;
    news._y = 20*copy; // <-- what were you trying to do there? Try something like what i just put there.
}

```

thanx,

i’ll try this code. this code creates 10 movieclips. Does someone knows how i can add some code to communicate with mySQL to add the amount of records instead of a given number?

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 27, 2006, 6:27pm UTC](https://forum.kirupa.com/t/flash-8-duplicate-movieclip/183502/4 "2006-03-27T18:27:10Z")

</div>

you need to get a total in php then pass it as a variable to flash, for use in place of the “10” thats there right now.

Post your php file and i’ll see if i can modify it for ya

---

<div class="post-metadata">

**Author:** ![MyDNA](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@MyDNA](https://forum.kirupa.com/u/MyDNA)\
**Post date:** [March 27, 2006, 9:08pm UTC](https://forum.kirupa.com/t/flash-8-duplicate-movieclip/183502/5 "2006-03-27T21:08:24Z")

</div>

thanks for all the time you take for me.  
All the scripts and the main flashfile (so you can see how it’s build) are together at

[http://www.dri360.com/news.zip](http://www.dri360.com/news.zip)

the main php file is: “maak\_nieuws\_berichten.php” this is the file wich is loading within the flashfile.

For questions you can write a post or email me at [jos@it-bone.nl](mailto:jos@it-bone.nl)

ind regards Jos
