# Arrays as variables?

**URL:** <https://forum.kirupa.com/t/arrays-as-variables/211061>\
**Category:** Uncategorized\
**Created:** [December 26, 2006, 7:36pm UTC](https://forum.kirupa.com/t/arrays-as-variables/211061 "2006-12-26T19:36:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joakinrox](https://avatars.discourse-cdn.com/v4/letter/j/8dc957/32.png) [@joakinrox](https://forum.kirupa.com/u/joakinrox)\
**Post date:** [December 26, 2006, 7:36pm UTC](https://forum.kirupa.com/t/arrays-as-variables/211061/1 "2006-12-26T19:36:37Z")

</div>

hi guys, so i have question  
why cant the variable “height” modify the position of y? =S im new at ac so i dont know if an element of an array can be a variable? and how do i make it a variable?  
this is a par of the code im writing to make a group of movieclips appear offstage in a random positions as long as it is offstage (i know the array is not random since i give the values of each element but i tried by putting [COLOR=Red]y= math.random \* number?.[/COLOR]… but in the coordinates i didnt knew how to specify that it could be any random number exept the lenght of the stage)  
[COLOR=Red]  
onClipEvent (load) {  
myArray = new Array ();  
myArray[0]=-100;  
myArray[1]= 0;  
myArray[2]=100;  
myArray[3]=200;  
myArray[4]=300;  
variable= Math.random () \* 4;  
myArray2= myArray.slice (variable,variable+1);  
Height = myArray2  
trace (Height)  
trace (this.\_y)  
this.\_x = 200;  
this.\_y = Height;  
}[/COLOR]  
i really apreciate any help u guys can give me  
peace out
