# Gerenate random attachMovie

**URL:** <https://forum.kirupa.com/t/gerenate-random-attachmovie/179212>\
**Category:** Uncategorized\
**Created:** [February 17, 2006, 5:46pm UTC](https://forum.kirupa.com/t/gerenate-random-attachmovie/179212 "2006-02-17T17:46:59Z")\
**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/179212/1 "2006-02-17T17:46:59Z")

</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:

```
ActionScript Code:
[FONT=Courier New][LEFT]count1 = [COLOR=#000080]5[/COLOR];

```

[COLOR=#000000] **function** [/COLOR] createTestCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
filename1 = [COLOR=#000000][[/COLOR][COLOR=#FF0000]“obj1”[/COLOR], [COLOR=#FF0000]“obj2”[/COLOR][COLOR=#000000]][/COLOR];  
i = filename1.[COLOR=#0000FF]length[/COLOR];  
k = [COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]floor[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#0000FF]for[/COLOR] [COLOR=#000000]([/COLOR]i=[COLOR=#000080]0[/COLOR]; i\<count1; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]  
vazio1.[COLOR=#0000FF]attachMovie[/COLOR][COLOR=#000000]([/COLOR]filename1[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR], filename1[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR], i[COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]  
[/LEFT]  
[/FONT]

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! 😉
