# Gerenate random attachMovie

**URL:** <https://forum.kirupa.com/t/gerenate-random-attachmovie/179211>\
**Category:** flash\
**Created:** [February 17, 2006, 5:46pm UTC](https://forum.kirupa.com/t/gerenate-random-attachmovie/179211 "2006-02-17T17:46:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mvespa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mvespa/32/970_2.png) [@Mvespa](https://forum.kirupa.com/u/Mvespa)\
**Post date:** [February 17, 2006, 5:46pm UTC](https://forum.kirupa.com/t/gerenate-random-attachmovie/179211/1 "2006-02-17T17:46:15Z")

</div>

Hi!

I’m developing a game and the objective is to drag some objects to a container. Some objects add points, and some other subtract points.  
So, all the objects are in the library and have a linkage name to be called by attachMovie.  
I want to create an Array with all the objects that belong to container, like for example filename1 = [“obj1”, “obj2”, “obj3”]; etc…  
I have a var called count1 that defines the number of objects to appear on the Scene  
So what I have is:

count1 = 5;

function createTest() {  
filename1 = [“obj1”, “obj2”];  
i = filename1.length;  
k = Math.floor(Math.random()_i);  
for (i=0; i\<count1; i++) {  
vazio1.attachMovie(filename1_, filename1\*, i);  
}  
}

When I test this, only appears two objects because the array as only two objects, but what I want is to show “obj1+i” and “obj2+i” = 5 objects

How can I do this? Show 5 objects radomly, using obj1 and obj2?

Thanks

PS: Sorry about my english  
PS2: I think I’ll put this sentence “Sorry about my english” as signature! 😉
