# Auto Generation of Movie Clips

**URL:** <https://forum.kirupa.com/t/auto-generation-of-movie-clips/216339>\
**Category:** flash\
**Created:** [February 15, 2007, 4:37pm UTC](https://forum.kirupa.com/t/auto-generation-of-movie-clips/216339 "2007-02-15T16:37:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daro](https://avatars.discourse-cdn.com/v4/letter/d/e9a140/32.png) [@Daro](https://forum.kirupa.com/u/Daro)\
**Post date:** [February 15, 2007, 4:37pm UTC](https://forum.kirupa.com/t/auto-generation-of-movie-clips/216339/1 "2007-02-15T16:37:46Z")

</div>

First. I have a movie clip that I want to duplicate it X number of times.

X is based on the size of an array.

Here is the button Code:

onClipEvent (load) {  
this.\_x = random(500);  
this.\_y = random(400); //These will be different but I do need to set its x,y coordinates  
}  
on(rollOver){  
\_root.btnRollOver(x);  
}  
on(rollOut){  
\_root.song\_name\_text.text = “”;  
\_root.song\_description\_text.text = “”;  
}  
on(release){  
\_root.btnRelease(x);  
}

Function code:

for(var i = 0;i\<\_root.melody.length;i++){  
\_root.gloTemp = i;  
duplicateMovieClip (\_root.melody\_btn, “melody\_btn” + i, i); // creating the duplicate  
/\* INSERT \*/  
}

btnRollOver = function(x){  
\_root.song\_name\_text.text = \_root.melody[x].name;  
\_root.song\_description\_text.text = \_root.melody[x].effect;  
}

btnRelease = function(x){  
\_root.melodyAdd(x);  
}

At the INSERT point, I need to generate multiple symbols of the same type but I need to enter different Data into them and be able to determine which one is calling the btnRollOver and btnRelease functions because the x is a position in the array. Each array element holds a Song. I need to display the song information in the symbol itself, and then in a viewing field (dynamic text field) when they roll over the symbol. This make sense?

I need this to be automated because the arrays are constructed from an XML file that may change length.
